public override async Task CloseAsync(CancellationToken cancellationToken)
        {
            if (Logging.IsEnabled)
            {
                Logging.Enter(this, nameof(CloseAsync));
            }

            lock (_lock)
            {
                _closed = true;
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                using var ctb = new CancellationTokenBundle(_operationTimeout, cancellationToken);
                await _amqpUnit.CloseAsync(ctb.Token).ConfigureAwait(false);
            }
            finally
            {
                OnTransportClosedGracefully();
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, nameof(CloseAsync));
                }
            }
        }
Example #2
0
        public override async Task CloseAsync(CancellationToken cancellationToken)
        {
            Logging.Enter(this, nameof(CloseAsync));

            lock (_lock)
            {
                _closed = true;
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();
                await _amqpUnit.CloseAsync(_operationTimeout).ConfigureAwait(false);
            }
            finally
            {
                OnTransportClosedGracefully();
                Logging.Exit(this, nameof(CloseAsync));
            }
        }
Example #3
0
        public override async Task CloseAsync(CancellationToken cancellationToken)
        {
            if (Logging.IsEnabled)
            {
                Logging.Enter(this, $"{nameof(CloseAsync)}");
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();
                await _amqpUnit.CloseAsync(_operationTimeout).ConfigureAwait(false);

                OnTransportClosedGracefully();
            }
            finally
            {
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, $"{nameof(CloseAsync)}");
                }
            }
        }