private void CloseConnection(PooledConnection connection) { try { connection.Dispose(); } catch { } }
private void RemoveConnection(PooledConnection connection) { if (_listener != null) { _listener.ConnectionPoolBeforeRemovingAConnection(connection.ConnectionId); } var stopwatch = Stopwatch.StartNew(); connection.Dispose(); stopwatch.Stop(); if (_listener != null) { _listener.ConnectionPoolAfterRemovingAConnection(connection.ConnectionId, stopwatch.Elapsed); } }
private void ReleaseConnection(PooledConnection connection) { if (_state.Value == State.Disposed) { connection.Dispose(); return; } if (_listener != null) { _listener.ConnectionPoolBeforeCheckingInAConnection(connection.ConnectionId); } var stopwatch = Stopwatch.StartNew(); _connectionHolder.Return(connection); _poolQueue.Release(); stopwatch.Stop(); if (_listener != null) { _listener.ConnectionPoolAfterCheckingInAConnection(connection.ConnectionId, stopwatch.Elapsed); } }
private void RemoveConnection(PooledConnection connection) { if (_removingConnectionEventHandler != null) { _removingConnectionEventHandler(new ConnectionPoolRemovingConnectionEvent(connection.ConnectionId)); } var stopwatch = Stopwatch.StartNew(); connection.Dispose(); stopwatch.Stop(); if (_removedConnectionEventHandler != null) { _removedConnectionEventHandler(new ConnectionPoolRemovedConnectionEvent(connection.ConnectionId, stopwatch.Elapsed)); } }
private void ReleaseConnection(PooledConnection connection) { if (_state.Value == State.Disposed) { connection.Dispose(); return; } if (_checkingInConnectionEventHandler != null) { _checkingInConnectionEventHandler(new ConnectionPoolCheckingInConnectionEvent(connection.ConnectionId)); } var stopwatch = Stopwatch.StartNew(); _connectionHolder.Return(connection); _poolQueue.Release(); stopwatch.Stop(); if (_checkedInConnectionEventHandler != null) { _checkedInConnectionEventHandler(new ConnectionPoolCheckedInConnectionEvent(connection.ConnectionId, stopwatch.Elapsed)); } }