public class PooledConnectionQueue extends Object
| Constructor and Description |
|---|
PooledConnectionQueue(DataSourcePool pool) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeBusyConnections(long leakTimeMinutes)
Close any busy connections that have not been used for some time.
|
void |
closeFreeConnections(boolean logErrors)
Close all the connections that are in the free list.
|
void |
dumpBusyConnectionInformation() |
void |
ensureMinimumConnections() |
String |
getBusyConnectionInformation() |
PooledConnection |
getPooledConnection() |
DataSourcePoolStatistics |
getStatistics(boolean reset) |
DataSourcePool.Status |
getStatus(boolean reset) |
protected void |
reportClosingConnection(PooledConnection pooledConnection)
Collect statistics of a connection that is fully closing
|
void |
reset(long leakTimeMinutes)
Close all the connections in the pool and any current busy connections
when they are returned.
|
protected void |
returnPooledConnection(PooledConnection c,
boolean forceClose)
Return a PooledConnection.
|
void |
setMaxSize(int maxSize) |
void |
setMinSize(int minSize) |
void |
setWarningSize(int warningSize) |
void |
shutdown() |
String |
toString() |
void |
trim(long maxInactiveMillis,
long maxAgeMillis) |
public PooledConnectionQueue(DataSourcePool pool)
protected void reportClosingConnection(PooledConnection pooledConnection)
public DataSourcePoolStatistics getStatistics(boolean reset)
public DataSourcePool.Status getStatus(boolean reset)
public void setMinSize(int minSize)
public void setMaxSize(int maxSize)
public void setWarningSize(int warningSize)
public void ensureMinimumConnections()
throws SQLException
SQLExceptionprotected void returnPooledConnection(PooledConnection c, boolean forceClose)
public PooledConnection getPooledConnection() throws SQLException
SQLExceptionpublic void shutdown()
public void reset(long leakTimeMinutes)
This is typically done when a database down event occurs.
public void trim(long maxInactiveMillis,
long maxAgeMillis)
public void closeFreeConnections(boolean logErrors)
public void closeBusyConnections(long leakTimeMinutes)
These connections are considered to have leaked from the connection pool.
Connection leaks occur when code doesn't ensure that connections are closed() after they have been finished with. There should be an appropriate try catch finally block to ensure connections are always closed and put back into the pool.
public String getBusyConnectionInformation()
public void dumpBusyConnectionInformation()
Copyright © 2014. All Rights Reserved.