protected override void DisposeAll()
 {
     if (!PoolInitialized)
     {
         return;
     }
     PoolSuspended = true;
     foreach (var pool in Pools)
     {
         ConnectionStringPoolableBase poolItem;
         while (pool.Value.TryDequeue(out poolItem))
         {
             poolItem.Dispose(true);
         }
     }
     Pools.Clear();
     foreach (var semaphoreSlim in Semaphores)
     {
         if (semaphoreSlim.Value.CurrentCount > 0)
         {
             try
             {
                 semaphoreSlim.Value.Release(semaphoreSlim.Value.CurrentCount);
             }
             catch
             {
             }
         }
         try
         {
             semaphoreSlim.Value.Dispose();
         }
         catch
         {
         }
     }
     Semaphores.Clear();
     PoolInitialized = false;
     PoolSuspended   = false;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Clears the <see cref="Pools"/> and <see cref="ArrayPools"/> of any data.
 /// </summary>
 public void Clear()
 {
     Pools.Clear();
     ArrayPools.Clear();
 }