Package fr.paris.lutece.util.pool
Class PoolManager
java.lang.Object
fr.paris.lutece.util.pool.PoolManager
This class can manages a set of database connections pools. It's implemented as a singleton. It provides methods to get or release a connection from a given
pool.
-
Method Summary
Modifier and TypeMethodDescriptionvoidfreeConnection(String strPoolName, Connection con) Returns a connection to pool.getConnection(String strPoolName) Returns an available connection from the pool.getDataSource(String strPoolName) Returns the datasource for a given pool namestatic PoolManagergetInstance(InputStream isDbProperties) This method returns the unique instance of the PoolManager.getPools()Returns all pools availableReturns pool's infos (currently opened connections)voidrelease()Releases all connections from all the pool.
-
Method Details
-
getInstance
This method returns the unique instance of the PoolManager.- Parameters:
isDbProperties- An InputStream on a db.properties File to initialiaze the pool if it's not already created.- Returns:
- The unique instance of Poolmanager.
- Throws:
LuteceInitException- If any error occured
-
getConnection
Returns an available connection from the pool.- Parameters:
strPoolName- The pool name- Returns:
- A connection
-
freeConnection
Returns a connection to pool.- Parameters:
strPoolName- Pool's namecon- A released connection
-
release
public void release()Releases all connections from all the pool. -
getPools
Returns all pools available- Returns:
- The list of available pools
-
getPoolsInfos
Returns pool's infos (currently opened connections)- Returns:
- The pool's infos
-
getDataSource
Returns the datasource for a given pool name- Parameters:
strPoolName- The Pool name- Returns:
- A data source object
-