예제 #1
0
 internal override void ReturnToPool(PoolableBase poolableBase)
 {
     InUse--;
     poolableBase.Used = false;
     Pool.Enqueue(poolableBase);
     locker.Release();
 }
        internal override void ReturnToPool(PoolableBase poolableBase)
        {
            var item = poolableBase as ConnectionStringPoolableBase;

            Log(string.Format("Returning item to pool {0}", item.ConnectionString));
            var pool   = Pools[GetPoolName(item.ConnectionString)];
            var locker = GetLocker(item.ConnectionString);

            try
            {
                pool.Enqueue(item);
            }
            catch (Exception ex)
            {
                Logging.DebugMessage(string.Format("Enqueue failed: {0}", item.ConnectionString), EventLogEntryType.SuccessAudit, "POOL");
                ex.Log();
            }
            item.Used = false;
            locker.Release();
            diagnosticsHandler.AddMetric(GetPoolName(item.ConnectionString), PoolSize - locker.CurrentCount);
            Log(string.Format("Item {0} returned to pool. Pool consumption {1}/{2} ", item.ConnectionString, PoolSize - locker.CurrentCount, PoolSize));
        }
예제 #3
0
 internal abstract void ReturnToPool(PoolableBase poolableBase);
예제 #4
0
 internal abstract void ReturnToPool(PoolableBase poolableBase);