Example #1
0
        /// <summary>
        ///     Disconnects this instance.
        /// </summary>
        public void Disconnect( )
        {
            lock ( _syncRoot )
            {
                if (ActiveConnection != null)
                {
                    string host = null;

                    if (ActiveConnection.Configuration != null)
                    {
                        ConfigurationOptions configurationOptions = ConfigurationOptions.Parse(ActiveConnection.Configuration);

                        if (configurationOptions.EndPoints != null && configurationOptions.EndPoints.Count > 0)
                        {
                            host = GetEndPointHost(configurationOptions.EndPoints[0]);
                        }
                    }

                    ActiveConnection.Close( );
                    ActiveConnection.Dispose( );
                    ActiveConnection = null;

                    EventLog.Application.WriteInformation("Connection to Redis server{0} closed.", string.IsNullOrEmpty(host) ? string.Empty : string.Format(" ('{0}')", host));
                }
            }
        }
Example #2
0
 private static void DisposeTransaction()
 {
     if (TransactionCounter <= 0)
     {
         ActiveConnection.Dispose();
         ActiveConnection = null;
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             ActiveConnection?.Dispose();
         }
     }
     _disposed = true;
 }
        /// <summary>
        ///   Performs the task needed to clean up resources used by the <see cref="AmqpConnectionScope" />,
        ///   including ensuring that the client itself has been closed.
        /// </summary>
        ///
        public override void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            ActiveConnection?.Dispose();
            OperationCancellationSource.Cancel();
            OperationCancellationSource.Dispose();

            IsDisposed = true;
        }
Example #5
0
        public void Dispose()
        {
            if (wasOpenTransaction)
            {
                _activeTransaction.Rollback();
                _activeTransaction.Dispose();
                wasOpenTransaction = false;
            }

            if (ActiveConnection != null)
            {
                ActiveConnection.Close();
                ActiveConnection.Dispose();
            }
        }