Пример #1
0
        public override void Dispose()
        {
            // If the connection was taken from a pool, return it to the pool.
            // Otherwise, dispose the underlying end-point and transition to "disposed" state.

            var poolReclamation = Interlocked.Exchange(ref _poolReclamation, null);

            if (poolReclamation != null)
            {
                poolReclamation.Return(this);
                return;
            }

            if (_disposed)
            {
                return;
            }

            _disposed = true;

            // dispose service and snapshot channels
            _serviceEndPoint.UnexpectedExceptionThrown -= UnexpectedExceptionThrown;
            _serviceEndPoint.Dispose();
#if DEBUG
            GC.SuppressFinalize(this);
#endif
        }
Пример #2
0
        public void Dispose()
        {
            if (EndPoint.IsDisposed)
            {
                // guard us from double disposing. this can happen in unit test
                // due to how we create test mock service hub stream that tied to
                // remote host service
                return;
            }

            EndPoint.Dispose();

            Log(TraceEventType.Information, "Service instance disposed");
        }