ChannelPool.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / ChannelPool.cs / 1 / ChannelPool.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel.Channels 
{
    using System.Collections.Generic; 
    using System.ServiceModel; 
    using System.Runtime.Serialization;
    using System.Xml; 
    using System.ServiceModel.Description;
    using System.ServiceModel.Security;
    using System.Text;
 
    /// 
    /// Pool of channels used by OneWayChannelFactories 
    ///  
    class ChannelPool : IdlingCommunicationPool
        where TChannel : class, IChannel 
    {
        public ChannelPool(ChannelPoolSettings settings)
            : base(settings.MaxOutboundChannelsPerEndpoint, settings.IdleTimeout, settings.LeaseTimeout)
        { 
        }
 
        protected override void AbortItem(TChannel item) 
        {
            item.Abort(); 
        }

        protected override void CloseItem(TChannel item, TimeSpan timeout)
        { 
            item.Close(timeout);
        } 
 
        protected override ChannelPoolKey GetPoolKey(EndpointAddress address, Uri via)
        { 
            return new ChannelPoolKey(address, via);
        }
    }
 
    class ChannelPoolKey : IEquatable
    { 
        EndpointAddress address; 
        Uri via;
 
        public ChannelPoolKey(EndpointAddress address, Uri via)
        {
            this.address = address;
            this.via = via; 
        }
 
        public override int GetHashCode() 
        {
            return address.GetHashCode() + via.GetHashCode(); 
        }

        public bool Equals(ChannelPoolKey other)
        { 
            return address.EndpointEquals(other.address) && via.Equals(other.via);
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK