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 static void RemoveConnection(Driver driver)
        {
            Debug.Assert(driver != null);

            MySqlPool pool = driver.Pool;

            pool?.RemoveConnection(driver);
        }
		public static void RemoveConnection(Driver driver)
		{
			MySqlPool pool = driver.Pool;
			if (pool == null)
			{
				return;
			}
			pool.RemoveConnection(driver);
		}
Esempio n. 3
0
 public static void RemoveConnection(Driver driver)
 {
     lock (pools.SyncRoot)
     {
         string    key  = driver.Settings.GetConnectionString(true);
         MySqlPool pool = (MySqlPool)pools[key];
         if (pool == null)
         {
             throw new MySqlException("Pooling exception: Unable to find original pool for connection");
         }
         pool.RemoveConnection(driver);
     }
 }
Esempio n. 4
0
        public static void RemoveConnection(Driver driver)
        {
            Debug.Assert(driver != null);

//      var pool = driver.Pool;
            MySqlPool pool = driver.Pool;

            if (pool == null)
            {
                return;
            }

            pool.RemoveConnection(driver);
        }
Esempio n. 5
0
        public static void RemoveConnection(Driver driver)
        {
            string    key  = driver.Settings.GetConnectionString(true);
            MySqlPool pool = (MySqlPool)pools[key];

            // if we can't find the pool but we did get a thread id then we assume
            // something is bad wrong.  If we didn't get a thread id then we assume that
            // the driver connection info was bogus and that led to the pool failing
            // to create
            if (pool == null)
            {
                if (driver.ThreadID != -1)
                {
                    throw new MySqlException("Pooling exception: Unable to find original pool for connection");
                }
            }
            else
            {
                pool.RemoveConnection(driver);
            }
        }