MySql.Data.MySqlClient.MySqlPool.RemoveConnection C# (CSharp) Method

RemoveConnection() public method

Removes a connection from the in use pool. The only situations where this method would be called are when a connection that is in use gets some type of fatal exception or when the connection is being returned to the pool and it's too old to be returned.
public RemoveConnection ( Driver driver ) : void
driver Driver
return void
        public void RemoveConnection(Driver driver)
        {
            lock ((inUsePool as ICollection).SyncRoot)
            {
                if (inUsePool.Contains(driver))
                {
                    inUsePool.Remove(driver);
                    Interlocked.Increment(ref available);
                    autoEvent.Set();
                }
            }

            // if we are being cleared and we are out of connections then have
            // the manager destroy us.
            if (beingCleared && NumConnections == 0)
                MySqlPoolManager.RemoveClearedPool(this);
        }

Usage Example

        public static void RemoveConnection(Driver driver)
        {
            Debug.Assert(driver != null);

            MySqlPool pool = driver.Pool;

            pool?.RemoveConnection(driver);
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlPool::RemoveConnection