public abstract class ConnectionPool<ConnectionType> extends Object implements XPooledConnectionEventListener<ConnectionType>
| Modifier and Type | Field and Description |
|---|---|
protected List<XPooledConnection<ConnectionType>> |
connections |
| Constructor and Description |
|---|
ConnectionPool(ConnectionFactory<ConnectionType> connectionFactory,
ConnectionPoolProperties properties) |
| Modifier and Type | Method and Description |
|---|---|
int |
availableSize()
The amount of pooled connections in state available.
|
ConnectionType |
borrowConnection()
Borrows a connection from the pool.
|
void |
destroy() |
protected void |
destroyPooledConnection(XPooledConnection<ConnectionType> xpc) |
protected void |
logCurrentPoolSize() |
void |
onXPooledConnectionTerminated(XPooledConnection<ConnectionType> connection)
fired when a connection changed its state to terminated
|
protected abstract ConnectionType |
recycleConnectionIfPossible() |
void |
refresh() |
protected abstract ConnectionType |
retrieveFirstAvailableConnection() |
String |
toString() |
int |
totalSize()
The total amount of pooled connections in any state.
|
protected List<XPooledConnection<ConnectionType>> connections
public ConnectionPool(ConnectionFactory<ConnectionType> connectionFactory, ConnectionPoolProperties properties) throws ConnectionPoolException
ConnectionPoolExceptionprotected abstract ConnectionType recycleConnectionIfPossible() throws Exception
Exceptionpublic ConnectionType borrowConnection() throws CreateConnectionException, PoolExhaustedException, ConnectionPoolException
CreateConnectionException - If the pool attempted to grow but failed.PoolExhaustedException - If the pool could not grow because it is exhausted.ConnectionPoolException - Other errors.protected void logCurrentPoolSize()
protected abstract ConnectionType retrieveFirstAvailableConnection()
protected void destroyPooledConnection(XPooledConnection<ConnectionType> xpc)
public void destroy()
public void refresh()
public int availableSize()
public int totalSize()
public void onXPooledConnectionTerminated(XPooledConnection<ConnectionType> connection)
XPooledConnectionEventListeneronXPooledConnectionTerminated in interface XPooledConnectionEventListener<ConnectionType>Copyright © 2023. All rights reserved.