private void ReinitChannel(bool isSync = false) { var oldChannel = _channel; if (oldChannel != null) { oldChannel.Closed -= ChannelClosedHandler; oldChannel.Opened -= ChannelOpenedHandler; } var newChannel = new ConcurrentConnection((IClientChannel)_factory.CreateChannel(), _maxAsyncQueryCount); if (Interlocked.CompareExchange(ref _channel, newChannel, oldChannel) != oldChannel || _isDisposed) { newChannel.Dispose(); } else { _openWaiter.Reset(); OnConnectionRecreated(); newChannel.Closed += ChannelClosedHandler; newChannel.Opened += ChannelOpenedHandler; if (isSync) { newChannel.Open(); } else { newChannel.OpenAsync(); } } if (oldChannel != null) { oldChannel.Dispose(); } }
public ConcurrentRequestTracker(ConcurrentConnection conSrc) { Contract.Requires(conSrc != null); _connectionSource = conSrc; }
protected ConcurrentRequestTracker() { _connectionSource = null; }