コード例 #1
0
 private void CloseConnection(PooledConnection connection)
 {
     try
     {
         connection.Dispose();
     }
     catch { }
 }
コード例 #2
0
            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);
                }
            }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
            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));
                }
            }
コード例 #5
0
        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));
            }
        }