Beispiel #1
0
        public void Clear()
        {
            lock (_poolState)
            {
                _poolState.ThrowIfNotInitialized();

                if (_poolState.TransitionState(State.Paused))
                {
                    _clearingEventHandler?.Invoke(new ConnectionPoolClearingEvent(_serverId, _settings));

                    _maintenanceHelper.Cancel();
                    _generation++;

                    _maxConnectionsQueue.Signal();
                    _maxConnectingQueue.Signal();

                    _clearedEventHandler?.Invoke(new ConnectionPoolClearedEvent(_serverId, _settings));
                }
            }
        }
Beispiel #2
0
        public void Clear(bool closeInUseConnections = false)
        {
            lock (_poolState)
            {
                _poolState.ThrowIfNotInitialized();

                if (_poolState.TransitionState(State.Paused))
                {
                    _clearingEventHandler?.Invoke(new ConnectionPoolClearingEvent(_serverId, _settings));

                    int?maxGenerationToReap = closeInUseConnections ? _generation : null;
                    _generation++;
                    _maintenanceHelper.Stop(maxGenerationToReap);

                    _maxConnectionsQueue.Signal();
                    _maxConnectingQueue.Signal();

                    _clearedEventHandler?.Invoke(new ConnectionPoolClearedEvent(_serverId, _settings));
                }
            }
        }