Manage a pool of connections.

CAUTION: Methods should be called under the protection of a lock. This class does no locking of its own.

There's no limit on the number of connections this can keep track of, but a warning is logged if there are more than pool_size active connections, and a critical problem if more than twice pool_size.

New connections are registered via push(). This will log a message if "too many" connections are active.

When a connection is explicitly closed, tell the pool via repush(). That adds the connection to a stack of connections available for reuse, and throws away the oldest stack entries if the stack is too large. pop() pops this stack.

When a connection is obtained via pop(), the pool holds only a weak reference to it thereafter. It's not necessary to inform the pool if the connection goes away. A connection handed out by pop() counts against pool_size only so long as it exists, and provided it isn't repush()'ed. A weak reference is retained so that DB methods like connectionDebugInfo() can still gather statistics.

Base classes

Implemented Interfaces

There are no implemented interfaces.


There are no attributes in this class.


Known Subclasses

There are no known subclasses.