public static void SetDriverInTransaction(Driver driver)
 {
     lock (driversInUse.SyncRoot)
     {
         driversInUse[driver.CurrentTransaction.BaseTransaction.GetHashCode()] = driver;
     }
 }
示例#2
0
 public static void RemoveConnection(Driver driver)
 {
     MySqlPool pool = driver.Pool;
     if (pool != null)
     {
         pool.RemoveConnection(driver);
     }
 }
示例#3
0
 public void RemoveConnection(Driver driver)
 {
     lock (((ICollection) this.inUsePool).SyncRoot)
     {
         if (this.inUsePool.Contains(driver))
         {
             this.inUsePool.Remove(driver);
             Interlocked.Increment(ref this.available);
             this.autoEvent.Set();
         }
     }
     if (this.beingCleared && (this.NumConnections == 0))
     {
         MySqlPoolManager.RemoveClearedPool(this);
     }
 }
示例#4
0
 public void ReleaseConnection(Driver driver)
 {
     lock (((ICollection) this.inUsePool).SyncRoot)
     {
         if (this.inUsePool.Contains(driver))
         {
             this.inUsePool.Remove(driver);
         }
     }
     if (driver.IsTooOld() || this.beingCleared)
     {
         driver.Close();
     }
     else
     {
         lock (((ICollection) this.idlePool).SyncRoot)
         {
             this.idlePool.Enqueue(driver);
         }
     }
     Interlocked.Increment(ref this.available);
     this.autoEvent.Set();
 }