コード例 #1
0
 private void SignalOrReset()
 {
     // Should be invoked under lock only
     if (_connections.Count == 0)
     {
         // no connections are available, clear the signal flag
         _semaphoreSlimSignalable.Reset();
     }
     else
     {
         // signal that connections are available
         _semaphoreSlimSignalable.Signal();
     }
 }
コード例 #2
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));
                }
            }
        }
コード例 #3
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));
                }
            }
        }