public void Dispose() { if (_connectingWaitStatus == SemaphoreSlimSignalable.SemaphoreWaitResult.Entered) { _pool._maxConnectingQueue.Release(); } if (_disposeConnection) { _connection?.Dispose(); } }
public void Dispose() { if (_connectingWaitStatus == SemaphoreSlimSignalable.SemaphoreWaitResult.Entered) { _pool._connectingQueue.Release(); } if (_disposeConnection) { // TODO SDAM spec: topology.handle_pre_handshake_error(error) # if possible, defer error handling to SDAM _connection?.Dispose(); } }
public void Dispose() { if (_connectingWaitStatus == SemaphoreSlimSignalable.SemaphoreWaitResult.Entered) { _pool._maxConnectingQueue.Release(); } if (_disposeConnection && _connection != null) { _pool.ConnectionHolder.UntrackInUseConnection(_connection); _connection.Dispose(); } }
private void RemoveConnection(PooledConnection connection) { if (_removingConnectionEventHandler != null) { _removingConnectionEventHandler(new ConnectionPoolRemovingConnectionEvent(connection.ConnectionId, EventContext.OperationId)); } var stopwatch = Stopwatch.StartNew(); connection.Dispose(); stopwatch.Stop(); if (_removedConnectionEventHandler != null) { _removedConnectionEventHandler(new ConnectionPoolRemovedConnectionEvent(connection.ConnectionId, stopwatch.Elapsed, EventContext.OperationId)); } }
private void RemoveConnection(PooledConnection connection) { if (_listener != null) { _listener.ConnectionPoolBeforeRemovingAConnection(new ConnectionPoolBeforeRemovingAConnectionEvent(connection.ConnectionId)); } var stopwatch = Stopwatch.StartNew(); connection.Dispose(); stopwatch.Stop(); if (_listener != null) { _listener.ConnectionPoolAfterRemovingAConnection(new ConnectionPoolAfterRemovingAConnectionEvent(connection.ConnectionId, stopwatch.Elapsed)); } }
public void RemoveConnection(PooledConnection connection) { if (_removingConnectionEventHandler != null) { _removingConnectionEventHandler(new ConnectionPoolRemovingConnectionEvent(connection.ConnectionId, EventContext.OperationId)); } var stopwatch = Stopwatch.StartNew(); UntrackInUseConnection(connection); // no op if connection is not in use connection.Dispose(); stopwatch.Stop(); if (_removedConnectionEventHandler != null) { _removedConnectionEventHandler(new ConnectionPoolRemovedConnectionEvent(connection.ConnectionId, stopwatch.Elapsed, EventContext.OperationId)); } }
private void ReleaseConnection(PooledConnection connection) { if (_state.Value == State.Disposed) { connection.Dispose(); return; } if (_checkingInConnectionEventHandler != null) { _checkingInConnectionEventHandler(new ConnectionPoolCheckingInConnectionEvent(connection.ConnectionId, EventContext.OperationId)); } var stopwatch = Stopwatch.StartNew(); _connectionHolder.Return(connection); _poolQueue.Release(); stopwatch.Stop(); if (_checkedInConnectionEventHandler != null) { _checkedInConnectionEventHandler(new ConnectionPoolCheckedInConnectionEvent(connection.ConnectionId, stopwatch.Elapsed, EventContext.OperationId)); } }
private void ReleaseConnection(PooledConnection connection) { if (_state.Value == State.Disposed) { connection.Dispose(); return; } if (_listener != null) { _listener.ConnectionPoolBeforeCheckingInAConnection(new ConnectionPoolBeforeCheckingInAConnectionEvent(connection.ConnectionId)); } var stopwatch = Stopwatch.StartNew(); _connectionHolder.Return(connection); _poolQueue.Release(); stopwatch.Stop(); if (_listener != null) { _listener.ConnectionPoolAfterCheckingInAConnection(new ConnectionPoolAfterCheckingInAConnectionEvent(connection.ConnectionId, stopwatch.Elapsed)); } }