Package fr.paris.lutece.util.pool
Class PoolManager
- java.lang.Object
-
- fr.paris.lutece.util.pool.PoolManager
-
public final class PoolManager extends Object
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfreeConnection(String strPoolName, Connection con)Returns a connection to pool.ConnectiongetConnection(String strPoolName)Returns an available connection from the pool.DataSourcegetDataSource(String strPoolName)Returns the datasource for a given pool namestatic PoolManagergetInstance(InputStream isDbProperties)This method returns the unique instance of the PoolManager.Collection<ConnectionService>getPools()Returns all pools availableReferenceListgetPoolsInfos()Returns pool's infos (currently opened connections)voidrelease()Releases all connections from all the pool.
-
-
-
Method Detail
-
getInstance
public static PoolManager getInstance(InputStream isDbProperties) throws LuteceInitException
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
public Connection getConnection(String strPoolName)
Returns an available connection from the pool.- Parameters:
strPoolName- The pool name- Returns:
- A connection
-
freeConnection
public void freeConnection(String strPoolName, Connection con)
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
public Collection<ConnectionService> getPools()
Returns all pools available- Returns:
- The list of available pools
-
getPoolsInfos
public ReferenceList getPoolsInfos()
Returns pool's infos (currently opened connections)- Returns:
- The pool's infos
-
getDataSource
public DataSource getDataSource(String strPoolName)
Returns the datasource for a given pool name- Parameters:
strPoolName- The Pool name- Returns:
- A data source object
-
-