C# Class MySql.Data.MySqlClient.MySqlPool

Summary description for MySqlPool.
Exibir arquivo Open project: elevate/mysqlconnector-.net Class Usage Examples

Private Properties

Property Type Description
Clear void
CreateNewPooledConnection Driver
EnqueueIdle void
GetPooledConnection Driver
RemoveOldIdleConnections List
TryToGetDriver Driver

Public Methods

Method Description
GetConnection ( ) : Driver
MySqlPool ( MySqlConnectionStringBuilder settings ) : System
ReleaseConnection ( Driver driver ) : void
RemoveConnection ( Driver driver ) : void

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.

Private Methods

Method Description
Clear ( ) : void

Clears this pool of all idle connections and marks this pool and being cleared so all other connections are closed when they are returned.

CreateNewPooledConnection ( ) : Driver

It is assumed that this method is only called from inside an active lock.

EnqueueIdle ( Driver driver ) : void
GetPooledConnection ( ) : Driver

It is assumed that this method is only called from inside an active lock.

RemoveOldIdleConnections ( ) : List

Remove expired drivers from the idle pool

Closing driver is a potentially lengthy operation involving network IO. Therefore we do not close expired drivers while holding idlePool.SyncRoot lock. We just remove the old drivers from the idle queue and return them to the caller. The caller will need to close them (or let GC close them)

TryToGetDriver ( ) : Driver

Method Details

GetConnection() public method

public GetConnection ( ) : Driver
return Driver

MySqlPool() public method

public MySqlPool ( MySqlConnectionStringBuilder settings ) : System
settings MySqlConnectionStringBuilder
return System

ReleaseConnection() public method

public ReleaseConnection ( Driver driver ) : void
driver Driver
return void

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