public void Release(ConnectionPool pool, TimeSpan timeout)
 {
     lock (this.ThisLock)
     {
         if (pool.Close(timeout))
         {
             List <ConnectionPool> list = this.registry[pool.Name];
             for (int i = 0; i < list.Count; i++)
             {
                 if (object.ReferenceEquals(list[i], pool))
                 {
                     list.RemoveAt(i);
                     break;
                 }
             }
             if (list.Count == 0)
             {
                 this.registry.Remove(pool.Name);
             }
         }
     }
 }
Esempio n. 2
0
        public void Release(ConnectionPool pool, TimeSpan timeout)
        {
            lock (ThisLock)
            {
                if (pool.Close(timeout))
                {
                    List <ConnectionPool> registryEntry = _registry[pool.Name];
                    for (int i = 0; i < registryEntry.Count; i++)
                    {
                        if (object.ReferenceEquals(registryEntry[i], pool))
                        {
                            registryEntry.RemoveAt(i);
                            break;
                        }
                    }

                    if (registryEntry.Count == 0)
                    {
                        _registry.Remove(pool.Name);
                    }
                }
            }
        }