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 Details

    • 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 name
      con - 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