public virtual void Release(IMessagingChannel channel, int token) { if (channel == null) { throw new ArgumentNullException("channel"); } Log.Verbose("Trying to release the channel back to the pool for reuse."); bool value; if (!this.open.TryRemove(channel, out value)) { throw new InvalidOperationException("Cannot release a channel that didn't originate with this connector."); } if (this.currentToken >= 0 && this.currentToken == token && channel.Active) { this.available[channel.CurrentConfiguration.GroupName].Add(channel); } else { channel.TryDispose(); } }
public virtual void Teardown(IMessagingChannel channel, int token) { if (channel == null) throw new ArgumentNullException("channel"); if (!this.open.ContainsKey(channel)) throw new InvalidOperationException("Cannot tear down a channel that didn't originate with this connector."); if (this.FirstOneThrough(token, token + 1)) this.ClearAvailableChannels(); Log.Verbose("Tearing down channel."); channel.TryDispose(); }
public virtual void Release(IMessagingChannel channel, int token) { if (channel == null) throw new ArgumentNullException("channel"); Log.Verbose("Trying to release the channel back to the pool for reuse."); bool value; if (!this.open.TryRemove(channel, out value)) throw new InvalidOperationException("Cannot release a channel that didn't originate with this connector."); if (this.currentToken >= 0 && this.currentToken == token && channel.Active) this.available[channel.CurrentConfiguration.GroupName].Add(channel); else channel.TryDispose(); }
public virtual void Teardown(IMessagingChannel channel, int token) { if (channel == null) { throw new ArgumentNullException("channel"); } if (!this.open.ContainsKey(channel)) { throw new InvalidOperationException("Cannot tear down a channel that didn't originate with this connector."); } if (this.FirstOneThrough(token, token + 1)) { this.ClearAvailableChannels(); } Log.Verbose("Tearing down channel."); channel.TryDispose(); }