public class ConnectionPool
extends java.lang.Object
ConnectionHolder
Constructor and Description |
---|
ConnectionPool(ConnectionSpecification connectionSpecification)
Constructs a new connection pool.
|
Modifier and Type | Method and Description |
---|---|
void |
checkAndCleanUpPool()
Cleans up the connection pool and removes no more valid connections
or vacant connection more than defined maximum.
|
void |
closeAllConnections()
Closes all connections of the pool.
|
protected void |
finalize() |
ConnectionHolder |
getPrivateConnectionHolder()
Returns a for private use locked connection holder.
|
java.sql.Connection |
recover(java.sql.Connection connection)
Checks in pool whether this connection is cached and closed or broken, recovers
and returns newly created connection if so.
|
void |
removeAllExcept(java.sql.Connection connection)
Removes all connection holder except the holder that holds the connection as specified.
|
void |
reset()
Resets the connection pool - sets the pool size to zero.
|
boolean |
resetIfAnyConnectionIsBroken() |
void |
takeBack(java.sql.Connection connectionToGiveBack)
Takes back a connection.
|
void |
takeBack(ConnectionHolder connectionHolderToGiveBack)
Takes back a connection holder.
|
public ConnectionPool(ConnectionSpecification connectionSpecification)
connectionSpecification
- the specification how to create the connectionpublic ConnectionHolder getPrivateConnectionHolder()
public java.sql.Connection recover(java.sql.Connection connection)
connection
- the connection to check if closed or brokenpublic void takeBack(java.sql.Connection connectionToGiveBack)
connectionToGiveBack
- the connection to give back.public void takeBack(ConnectionHolder connectionHolderToGiveBack)
connectionToGiveBack
- the connection to give back.public void removeAllExcept(java.sql.Connection connection)
connection
- the connection to be keptpublic boolean resetIfAnyConnectionIsBroken()
public void checkAndCleanUpPool()
public void closeAllConnections()
public void reset()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de