You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,138 @@
|
||||
//------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Channels
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime;
|
||||
using System.ServiceModel;
|
||||
|
||||
public class ChannelPoolSettings
|
||||
{
|
||||
TimeSpan idleTimeout;
|
||||
TimeSpan leaseTimeout;
|
||||
int maxOutboundChannelsPerEndpoint;
|
||||
|
||||
public ChannelPoolSettings()
|
||||
{
|
||||
this.idleTimeout = OneWayDefaults.IdleTimeout;
|
||||
this.leaseTimeout = OneWayDefaults.LeaseTimeout;
|
||||
this.maxOutboundChannelsPerEndpoint = OneWayDefaults.MaxOutboundChannelsPerEndpoint;
|
||||
}
|
||||
|
||||
ChannelPoolSettings(ChannelPoolSettings poolToBeCloned)
|
||||
{
|
||||
this.idleTimeout = poolToBeCloned.idleTimeout;
|
||||
this.leaseTimeout = poolToBeCloned.leaseTimeout;
|
||||
this.maxOutboundChannelsPerEndpoint = poolToBeCloned.maxOutboundChannelsPerEndpoint;
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(TimeSpan), OneWayDefaults.IdleTimeoutString)]
|
||||
public TimeSpan IdleTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.idleTimeout;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value < TimeSpan.Zero)
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
|
||||
SR.GetString(SR.SFxTimeoutOutOfRange0)));
|
||||
}
|
||||
|
||||
if (TimeoutHelper.IsTooLarge(value))
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
|
||||
SR.GetString(SR.SFxTimeoutOutOfRangeTooBig)));
|
||||
}
|
||||
|
||||
this.idleTimeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(TimeSpan), OneWayDefaults.LeaseTimeoutString)]
|
||||
public TimeSpan LeaseTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return leaseTimeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < TimeSpan.Zero)
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
|
||||
SR.GetString(SR.SFxTimeoutOutOfRange0)));
|
||||
}
|
||||
|
||||
if (TimeoutHelper.IsTooLarge(value))
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
|
||||
SR.GetString(SR.SFxTimeoutOutOfRangeTooBig)));
|
||||
}
|
||||
|
||||
this.leaseTimeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(OneWayDefaults.MaxOutboundChannelsPerEndpoint)]
|
||||
public int MaxOutboundChannelsPerEndpoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.maxOutboundChannelsPerEndpoint;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
|
||||
SR.GetString(SR.ValueMustBePositive)));
|
||||
}
|
||||
|
||||
this.maxOutboundChannelsPerEndpoint = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal ChannelPoolSettings Clone()
|
||||
{
|
||||
return new ChannelPoolSettings(this);
|
||||
}
|
||||
|
||||
internal bool IsMatch(ChannelPoolSettings channelPoolSettings)
|
||||
{
|
||||
if (channelPoolSettings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.idleTimeout != channelPoolSettings.idleTimeout)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.leaseTimeout != channelPoolSettings.leaseTimeout)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.maxOutboundChannelsPerEndpoint != channelPoolSettings.maxOutboundChannelsPerEndpoint)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool InternalShouldSerialize()
|
||||
{
|
||||
return (this.maxOutboundChannelsPerEndpoint != OneWayDefaults.MaxOutboundChannelsPerEndpoint
|
||||
|| this.idleTimeout != OneWayDefaults.IdleTimeout
|
||||
|| this.leaseTimeout != OneWayDefaults.LeaseTimeout);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user