Package fr.paris.lutece.util.pool
Class PoolManager
- java.lang.Object
-
- fr.paris.lutece.util.pool.PoolManager
-
public final class PoolManager extends java.lang.ObjectThis 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(java.lang.String strPoolName, java.sql.Connection con)Returns a connection to pool.java.sql.ConnectiongetConnection(java.lang.String strPoolName)Returns an available connection from the pool.javax.sql.DataSourcegetDataSource(java.lang.String strPoolName)Returns the datasource for a given pool namestatic PoolManagergetInstance(java.io.InputStream isDbProperties)This method returns the unique instance of the PoolManager.java.util.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(java.io.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 java.sql.Connection getConnection(java.lang.String strPoolName)
Returns an available connection from the pool.- Parameters:
strPoolName- The pool name- Returns:
- A connection
-
freeConnection
public void freeConnection(java.lang.String strPoolName, java.sql.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 java.util.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 javax.sql.DataSource getDataSource(java.lang.String strPoolName)
Returns the datasource for a given pool name- Parameters:
strPoolName- The Pool name- Returns:
- A data source object
-
-