public void Dispose() { if (Interlocked.CompareExchange(ref disposed, 1, 0) == 1) { return; } var context = channel as IContextChannel; if (context != null) { foreach (var cleanUp in context.CleanUp()) { cleanUp.CleanUp(); } } var parameters = channel.GetProperty <ChannelParameterCollection>(); if (parameters != null) { foreach (var cleanUp in parameters.OfType <IWcfCleanUp>()) { cleanUp.CleanUp(); } } if (channel != null) { WcfUtils.ReleaseCommunicationObject(channel, closeTimeout); } }
public void Dispose() { var context = Channel as IContextChannel; if (context != null) { foreach (var cleanUp in context.Extensions.FindAll <IWcfCleanUp>()) { cleanUp.CleanUp(); } } var parameters = Channel.GetProperty <ChannelParameterCollection>(); if (parameters != null) { foreach (var cleanUp in parameters.OfType <IWcfCleanUp>()) { cleanUp.CleanUp(); } } if (Channel != null) { WcfUtils.ReleaseCommunicationObject(Channel, CloseTimeout); } }
private void ReleaseServiceHosts() { foreach (var serviceHost in hosts) { foreach (var cleanUp in serviceHost.Extensions.FindAll <IWcfCleanUp>()) { cleanUp.CleanUp(); } WcfUtils.ReleaseCommunicationObject(serviceHost, CloseTimeout); } }
public void RefreshChannel() { if (Channel == null || IsChannelUsable == false) { if (Channel != null) { WcfUtils.ReleaseCommunicationObject(Channel, CloseTimeout); } CreateChannel(); } }
private void Kernel_ComponentUnregistered(string key, IHandler handler) { var serviceHosts = handler.ComponentModel .ExtendedProperties[WcfConstants.ServiceHostsKey] as IList <ServiceHost>; if (serviceHosts != null) { foreach (var serviceHost in serviceHosts) { foreach (var cleanUp in serviceHost.Extensions.FindAll <IWcfCleanUp>()) { cleanUp.CleanUp(); } WcfUtils.ReleaseCommunicationObject(serviceHost, CloseTimeout); } } }
public IChannel RefreshChannel(bool force) { if (disposed != 0) { return(channel); } if (force == false) { using (@lock.ForReading()) { if (IsChannelUsable()) { return(channel); } } } using (var locker = @lock.ForReadingUpgradeable()) { if (force || IsChannelUsable() == false) { locker.Upgrade(); var oldChannel = channel; if (oldChannel != null) { WcfUtils.ReleaseCommunicationObject(oldChannel, closeTimeout); } CreateChannel(); NotifyChannelRefreshed(oldChannel, channel); } return(channel); } }