コード例 #1
0
ファイル: PoolManager.cs プロジェクト: takashi-okumura/npgsql
        internal void Clear()
        {
            NpgsqlConnector[] idleConnectors;
            lock (this)
            {
                idleConnectors = Idle.ToArray();
                Idle.Clear();
                EnsurePruningTimerState();
            }

            foreach (var connector in idleConnectors)
            {
                try { connector.Close(); }
                catch (Exception e)
                {
                    Log.Warn("Exception while closing connector during clear", e, connector.Id);
                }
            }
            _clearCounter++;
        }
コード例 #2
0
        internal void Clear()
        {
            NpgsqlConnector[] idleConnectors;
            lock (this)
            {
                idleConnectors = Idle.ToArray();
                Idle.Clear();
                EnsurePruningTimerState();
            }

            foreach (var connector in idleConnectors)
            {
                Counters.NumberOfPooledConnections.Decrement();
                Counters.NumberOfFreeConnections.Decrement();
                try { connector.Close(); }
                catch (Exception e)
                {
                    Log.Logger.LogWarning(NpgsqlEventId.ExceptionClearingConnector, e, "[{ConnectorId}] Exception while closing connector during clear", connector.Id);
                }
            }
            _clearCounter++;
        }