private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (Logging.IsEnabled)
            {
                Logging.Info(this, disposing, nameof(Dispose));
            }

            if (disposing)
            {
                _amqpIotConnection?.SafeClose();
                _lock?.Dispose();
                _amqpIotConnector?.Dispose();
                lock (_unitsLock)
                {
                    _amqpUnits.Clear();
                }
                _amqpAuthenticationRefresher?.Dispose();
            }

            _disposed = true;
        }
Beispiel #2
0
        private void Dispose(bool disposing)
        {
            try
            {
                if (Logging.IsEnabled)
                {
                    Logging.Enter(this, $"Disposed={_disposed}; disposing={disposing}", $"{nameof(AmqpConnectionHolder)}.{nameof(Dispose)}");
                }

                if (!_disposed)
                {
                    if (disposing)
                    {
                        _amqpIotConnection?.SafeClose();
                        _lock?.Dispose();
                        _amqpIotConnector?.Dispose();
                        lock (_unitsLock)
                        {
                            _amqpUnits.Clear();
                        }
                        _amqpAuthenticationRefresher?.Dispose();
                    }

                    _disposed = true;
                }
            }
            finally
            {
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, $"Disposed={_disposed}; disposing={disposing}", $"{nameof(AmqpConnectionHolder)}.{nameof(Dispose)}");
                }
            }
        }