Пример #1
0
        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();
            }
        }
Пример #2
0
        public ConcurrentRequestTracker(ConcurrentConnection conSrc)
        {
            Contract.Requires(conSrc != null);

            _connectionSource = conSrc;
        }
Пример #3
0
 protected ConcurrentRequestTracker()
 {
     _connectionSource = null;
 }