vibe.d beta banner
get vibe.d
0.7.31

Class ConnectionPool

Generic connection pool class.

class ConnectionPool(Connection);

The connection pool is creating connections using the supplied factory function as needed whenever lockConnection is called. Connections are associated to the calling fiber, as long as any copy of the returned LockedConnection object still exists. Connections that are not associated to any fiber will be kept in a pool of open connections for later reuse.

Note that, after retrieving a connection with lockConnection, the caller has to make sure that the connection is actually physically open and to reopen it if necessary. The ConnectionPool class has no knowledge of the internals of the connection objects.

Constructors

Constructors

NameDescription
this

Fields

Fields

NameTypeDescription
m_connectionFactoryConnection delegate()
m_connectionsConnection[]
m_lockCountint[const(Connection)]
m_semFreeListRef!LocalTaskSemaphore

Properties

Properties

NameTypeDescription
maxConcurrency[get, set]uintDetermines the maximum number of concurrently open connections.

Methods

Methods

NameDescription
lockConnectionRetrieves a connection to temporarily associate with the calling fiber.
Authors

Sönke Ludwig

Copyright

© 2012 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.