org.objectweb.jonas.dbm
Class Pool

java.lang.Object
  |
  +--org.objectweb.jonas.dbm.Pool

public class Pool
extends java.lang.Object

Connection Pool

Author:
Philippe Durieux Contributor(s): Markus Fritz 01/11/06 Christophe Ney cney@batisseurs.com for Lutris Technologies Added ResourceManagerListener mechanism to remove ThreadData dependency. 02/01/15 Dean Jennings - Map instead of Hashtable for tx2item and xac2item

Constructor Summary
Pool(ConnectionManager cmgr)
          Pool constructor
 
Method Summary
 void check4MaxAge()
          Check all connections not in a transaction if their maxage is reached and if so kill them.
 void closeAllConnections()
          Close all connections in the pool, when server is shut down.
 PoolItem closeConnection(javax.sql.XAConnection xac, int flag)
          Mark a specific Connection in the pool as closed.
 void freeConnections(javax.transaction.Transaction tx)
          The transaction has committed (or rolled back).
 int getCurrentNumberOfXAConnection()
          Management method:
 PoolItem newConnection(javax.sql.XAConnection xac, java.lang.String user, javax.transaction.Transaction tx)
          Add a new XAConnection in the pool
 PoolItem openConnection(java.lang.String user, javax.transaction.Transaction tx)
          lookup connection in the pool for this user/tx
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pool

public Pool(ConnectionManager cmgr)
Pool constructor
Method Detail

openConnection

public PoolItem openConnection(java.lang.String user,
                               javax.transaction.Transaction tx)
lookup connection in the pool for this user/tx
Parameters:
user - user name
tx - Transaction the connection is involved
Returns:
the free PoolItem or null if no item available

newConnection

public PoolItem newConnection(javax.sql.XAConnection xac,
                              java.lang.String user,
                              javax.transaction.Transaction tx)
Add a new XAConnection in the pool

freeConnections

public void freeConnections(javax.transaction.Transaction tx)
The transaction has committed (or rolled back). We can return its connections to the pool of available connections.
Parameters:
tx - the non null transaction

closeConnection

public PoolItem closeConnection(javax.sql.XAConnection xac,
                                int flag)
Mark a specific Connection in the pool as closed. If it is no longer associated to a Tx, we can free it.
Returns:
the PoolItem the connection is in (=> tx) or null if error.

check4MaxAge

public void check4MaxAge()
Check all connections not in a transaction if their maxage is reached and if so kill them.

closeAllConnections

public void closeAllConnections()
Close all connections in the pool, when server is shut down.

getCurrentNumberOfXAConnection

public int getCurrentNumberOfXAConnection()
Management method:
Returns:
int number of xa connection