예제 #1
0
 private void Shutdown()
 {
     if (Logging.IsEnabled)
     {
         Logging.Enter(this, AmqpConnection, $"{nameof(Shutdown)}");
     }
     AmqpAuthenticationRefresher?.StopLoop();
     AmqpConnection?.Abort();
     OnConnectionDisconnected?.Invoke(this, EventArgs.Empty);
     if (Logging.IsEnabled)
     {
         Logging.Exit(this, AmqpConnection, $"{nameof(Shutdown)}");
     }
 }
예제 #2
0
 private void OnConnectionClosed(object o, EventArgs args)
 {
     if (Logging.IsEnabled)
     {
         Logging.Enter(this, o, $"{nameof(OnConnectionClosed)}");
     }
     if (AmqpConnection != null && ReferenceEquals(AmqpConnection, o))
     {
         AmqpAuthenticationRefresher?.StopLoop();
         foreach (AmqpUnit unit in AmqpUnits.Values)
         {
             unit.OnConnectionDisconnected();
         }
         AmqpUnits.Clear();
         OnConnectionDisconnected?.Invoke(this, EventArgs.Empty);
     }
     if (Logging.IsEnabled)
     {
         Logging.Exit(this, o, $"{nameof(OnConnectionClosed)}");
     }
 }
예제 #3
0
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (Logging.IsEnabled)
            {
                Logging.Info(this, disposing, $"{nameof(Dispose)}");
            }
            if (disposing)
            {
                AmqpConnection?.Abort();
                Lock?.Dispose();
                Connector?.Dispose();
                AmqpUnits?.Clear();
                AmqpAuthenticationRefresher?.Dispose();
                OnConnectionDisconnected?.Invoke(this, EventArgs.Empty);
            }

            _disposed = true;
        }