fr.paris.lutece.util.pool
Class PoolManager

java.lang.Object
  extended by fr.paris.lutece.util.pool.PoolManager

public final class PoolManager
extends java.lang.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
 void freeConnection(java.lang.String strPoolName, java.sql.Connection con)
          Returns a connection to pool.
 java.sql.Connection getConnection(java.lang.String strPoolName)
          Returns an available connection from the pool.
static PoolManager getInstance(java.io.InputStream isDbProperties)
          This method returns the unique instance of the PoolManager.
 java.util.Enumeration getPoolsNames()
          Gives the name of all pools available
 void release()
          Releases all connections from all the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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 name
con - A released connection

release

public void release()
Releases all connections from all the pool.


getPoolsNames

public java.util.Enumeration getPoolsNames()
Gives the name of all pools available

Returns:
The list of available pools


Copyright © 2007 Mairie de Paris. All Rights Reserved.