org.objectweb.jonas.dbm.Pool Class Reference

Collaboration diagram for org.objectweb.jonas.dbm.Pool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int getPoolMin ()
synchronized void setPoolMin (int min)
int getPoolMax ()
synchronized void setPoolMax (int max)
int getMaxAge ()
long getMaxAgeMilli ()
void setMaxAge (int mn)
int getMaxOpenTime ()
long getMaxOpenTimeMilli ()
void setMaxOpenTime (int mn)
int getMaxWaitTime ()
void setMaxWaitTime (int sec)
int getMaxWaiters ()
void setMaxWaiters (int nb)
int getSamplingPeriod ()
void setSamplingPeriod (int sec)
int getCheckLevel ()
void setCheckLevel (int level)
String getTestStatement ()
void setTestStatement (String s)
int getBusyMaxRecent ()
int getBusyMinRecent ()
int getCurrentWaiters ()
int getOpenedCount ()
int getConnectionFailures ()
int getConnectionLeaks ()
int getServedOpen ()
int getRejectedFull ()
int getRejectedTimeout ()
int getRejectedOther ()
int getRejectedOpen ()
int getWaitersHigh ()
int getWaitersHighRecent ()
int getWaiterCount ()
long getWaitingTime ()
long getWaitingHigh ()
long getWaitingHighRecent ()
 Pool (ConnectionManager cmgr, XADataSourceImpl xads) throws Exception
int getCurrentOpened ()
int getCurrentBusy ()
void recomputeBusy ()
int getCurrentInTx ()
synchronized PoolItem openConnection (String user, Transaction tx) throws SQLException
synchronized void freeConnections (Transaction tx)
synchronized PoolItem closeConnection (XAConnection xac, int flag)
synchronized void sampling ()
synchronized void adjust ()
synchronized void closeAllConnections ()

Detailed Description

Connection Pool
Author:
Philippe Durieux Contributor(s): 00/01/08 Markus Fritz make connection pooling thread safe (with same tx) introduce MaxAge for connections optimize pooling add some 'paranoia code': test conns before returning them from the pool. 00/18/04 Jun Inamori (j-office@osa.att.ne.jp) For closing correctly all connections at server shutdown. 01/11/06 Christophe Ney cney@batisseurs.com for Lutris Technologies Added ResourceManagerListener mechanism. 02/01/15 Dean Jennings - Map instead of Hashtable for lists 03/05/15 Adriana Danes - Introduce pool size configuration

Definition at line 64 of file Pool.java.


Constructor & Destructor Documentation

org.objectweb.jonas.dbm.Pool.Pool ConnectionManager  cmgr,
XADataSourceImpl  xads
throws Exception
 

Pool constructor

Parameters:
xads XA DataSource implementation created by this pool's Connection manager. Allows for getting XA Connections.
cmgr the pool's Connection manager has to be registered as ConnectionEventListener of the XA connections created at the pool creation
Exceptions:
Exception The pool could not be initialized

Definition at line 600 of file Pool.java.

References org.objectweb.jonas.jtm.TransactionService.getTransactionManager(), org.objectweb.jonas.service.ServiceManager.getTransactionService(), and org.objectweb.jonas.dbm.ConnectionManager.xads.

Here is the call graph for this function:


Member Function Documentation

synchronized void org.objectweb.jonas.dbm.Pool.adjust  ) 
 

Adjust the pool size, according to poolMax and poolMin values. Also remove old connections in the freeList.

Definition at line 912 of file Pool.java.

References org.objectweb.jonas.dbm.PoolItem.inactive(), org.objectweb.jonas.dbm.PoolItem.isAged(), and org.objectweb.jonas.dbm.PoolItem.remove().

Referenced by org.objectweb.jonas.dbm.PoolKeeper.run().

Here is the call graph for this function:

synchronized void org.objectweb.jonas.dbm.Pool.closeAllConnections  ) 
 

Close all connections in the pool, when server is shut down.

Definition at line 985 of file Pool.java.

synchronized PoolItem org.objectweb.jonas.dbm.Pool.closeConnection 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.

Parameters:
xac XAConnection being closed
flag TMSUCCESS (normal close) or TMFAIL (error)
Returns:
the PoolItem the connection is in (=> tx) or null if error.

Definition at line 847 of file Pool.java.

References org.objectweb.jonas.dbm.PoolItem.close(), org.objectweb.jonas.dbm.PoolItem.getTx(), and org.objectweb.jonas.dbm.PoolItem.isClosed().

Referenced by org.objectweb.jonas.dbm.ConnectionManager.connectionClosed(), and org.objectweb.jonas.dbm.ConnectionManager.connectionErrorOccurred().

Here is the call graph for this function:

synchronized void org.objectweb.jonas.dbm.Pool.freeConnections 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

Definition at line 820 of file Pool.java.

References org.objectweb.jonas.dbm.PoolItem.isOpen(), org.objectweb.jonas.dbm.PoolItem.remove(), and org.objectweb.jonas.dbm.PoolItem.setTx().

Referenced by org.objectweb.jonas.dbm.PoolItem.afterCompletion().

Here is the call graph for this function:

int org.objectweb.jonas.dbm.Pool.getBusyMaxRecent  ) 
 

Returns:
maximum nb of busy connections in last sampling period

Definition at line 395 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getBusyMax().

int org.objectweb.jonas.dbm.Pool.getBusyMinRecent  ) 
 

Returns:
minimum nb of busy connections in last sampling period

Definition at line 407 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getBusyMin().

int org.objectweb.jonas.dbm.Pool.getCheckLevel  ) 
 

Returns:
connection checking level

Definition at line 352 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcConnCheckLevel(), and org.objectweb.jonas.dbm.ConnectionManager.getReference().

int org.objectweb.jonas.dbm.Pool.getConnectionFailures  ) 
 

Returns:
int number of xa connection failures on open

Definition at line 443 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getConnectionFailures().

int org.objectweb.jonas.dbm.Pool.getConnectionLeaks  ) 
 

Returns:
int number of connection leaks

Definition at line 457 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getConnectionLeaks().

int org.objectweb.jonas.dbm.Pool.getCurrentBusy  ) 
 

Returns:
int number of busy xa connection

Definition at line 630 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getCurrentBusy().

int org.objectweb.jonas.dbm.Pool.getCurrentInTx  ) 
 

Returns:
int number of xa connection reserved for tx

Definition at line 650 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getCurrentInTx().

int org.objectweb.jonas.dbm.Pool.getCurrentOpened  ) 
 

Returns:
int number of xa connection

Definition at line 623 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getCurrentOpened(), and org.objectweb.jonas.dbm.ConnectionManager.getCurrentOpened().

int org.objectweb.jonas.dbm.Pool.getCurrentWaiters  ) 
 

Returns:
current number of connection waiters

Definition at line 419 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getCurrentWaiters().

int org.objectweb.jonas.dbm.Pool.getMaxAge  ) 
 

Returns:
max age for connections (in mm)

Definition at line 226 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcConnMaxAge(), and org.objectweb.jonas.dbm.ConnectionManager.getReference().

long org.objectweb.jonas.dbm.Pool.getMaxAgeMilli  ) 
 

Returns:
max age for connections (in millisec)

Definition at line 233 of file Pool.java.

int org.objectweb.jonas.dbm.Pool.getMaxOpenTime  ) 
 

Returns:
max age for connections (in mns)

Definition at line 259 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcMaxOpenTime(), and org.objectweb.jonas.dbm.ConnectionManager.getReference().

long org.objectweb.jonas.dbm.Pool.getMaxOpenTimeMilli  ) 
 

Returns:
max age for connections (in millisecs)

Definition at line 266 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.PoolItem.open().

int org.objectweb.jonas.dbm.Pool.getMaxWaiters  ) 
 

Returns:
max nb of waiters

Definition at line 306 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcMaxWaiters(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), and org.objectweb.jonas.dbm.ConnectionManager.poolConfigure().

int org.objectweb.jonas.dbm.Pool.getMaxWaitTime  ) 
 

Returns:
waiter timeout in seconds

Definition at line 287 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcMaxWaitTime(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), and org.objectweb.jonas.dbm.ConnectionManager.poolConfigure().

int org.objectweb.jonas.dbm.Pool.getOpenedCount  ) 
 

Returns:
int number of physical jdbc connection opened

Definition at line 431 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getOpenedCount().

int org.objectweb.jonas.dbm.Pool.getPoolMax  ) 
 

Returns:
actual max pool size

Definition at line 187 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcMaxConnPool(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), and org.objectweb.jonas.dbm.ConnectionManager.poolConfigure().

int org.objectweb.jonas.dbm.Pool.getPoolMin  ) 
 

Returns:
min pool size

Definition at line 164 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcMinConnPool(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), and org.objectweb.jonas.dbm.ConnectionManager.poolConfigure().

int org.objectweb.jonas.dbm.Pool.getRejectedFull  ) 
 

Returns:
int number of open calls that were rejected due to waiter overflow

Definition at line 481 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getRejectedFull().

int org.objectweb.jonas.dbm.Pool.getRejectedOpen  ) 
 

Returns:
int number of open calls that were rejected

Definition at line 512 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getRejectedOpen().

int org.objectweb.jonas.dbm.Pool.getRejectedOther  ) 
 

Returns:
int number of open calls that were rejected

Definition at line 505 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getRejectedOther().

int org.objectweb.jonas.dbm.Pool.getRejectedTimeout  ) 
 

Returns:
int number of open calls that were rejected by timeout

Definition at line 493 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getRejectedTimeout().

int org.objectweb.jonas.dbm.Pool.getSamplingPeriod  ) 
 

Returns:
sampling period in sec.

Definition at line 325 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcSamplingPeriod(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), and org.objectweb.jonas.dbm.ConnectionManager.poolConfigure().

int org.objectweb.jonas.dbm.Pool.getServedOpen  ) 
 

Returns:
int number of xa connection served

Definition at line 469 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getServedOpen().

String org.objectweb.jonas.dbm.Pool.getTestStatement  ) 
 

Returns:
test statement used when checkLevel = 2.

Definition at line 371 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getJdbcTestStatement(), and org.objectweb.jonas.dbm.ConnectionManager.getReference().

int org.objectweb.jonas.dbm.Pool.getWaiterCount  ) 
 

Returns:
total nb of waiters since the datasource creation

Definition at line 548 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaiterCount().

int org.objectweb.jonas.dbm.Pool.getWaitersHigh  ) 
 

Returns:
maximum nb of waiters since the datasource creation

Definition at line 524 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaitersHigh().

int org.objectweb.jonas.dbm.Pool.getWaitersHighRecent  ) 
 

Returns:
maximum nb of waiters in last sampling period

Definition at line 536 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaitersHighRecent().

long org.objectweb.jonas.dbm.Pool.getWaitingHigh  ) 
 

Returns:
max waiting time since the datasource creation

Definition at line 572 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaitingHigh().

long org.objectweb.jonas.dbm.Pool.getWaitingHighRecent  ) 
 

Returns:
max waiting time in last sampling period

Definition at line 584 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaitingHighRecent().

long org.objectweb.jonas.dbm.Pool.getWaitingTime  ) 
 

Returns:
total waiting time since the datasource creation

Definition at line 560 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.JDBCDataSource.getWaitingTime().

synchronized PoolItem org.objectweb.jonas.dbm.Pool.openConnection String  user,
Transaction  tx
throws SQLException
 

lookup connection in the pool for this user/tx

Parameters:
user user name
tx Transaction the connection is involved
Returns:
the free PoolItem (never null)
Exceptions:
SQLException Cannot open a connection because the pool's max size is reached

optimization is probably possible at this point

Definition at line 661 of file Pool.java.

References org.objectweb.jonas.jdbc_xa.ConnectionImpl.close(), org.objectweb.jonas.jdbc_xa.ConnectionImpl.createStatement(), org.objectweb.jonas.dbm.ConnectionManager.getDatasourceName(), org.objectweb.jonas.dbm.PoolItem.getXACon(), org.objectweb.jonas.jdbc_xa.ConnectionImpl.isPhysicallyClosed(), org.objectweb.jonas.dbm.PoolItem.open, and org.objectweb.jonas.dbm.PoolItem.setTx().

Referenced by org.objectweb.jonas.dbm.ConnectionManager.getConnection().

Here is the call graph for this function:

void org.objectweb.jonas.dbm.Pool.recomputeBusy  ) 
 

compute current min/max busyConnections

Definition at line 637 of file Pool.java.

synchronized void org.objectweb.jonas.dbm.Pool.sampling  ) 
 

make samples with some monitoring values

Definition at line 889 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.PoolKeeper.run().

void org.objectweb.jonas.dbm.Pool.setCheckLevel int  level  ) 
 

Parameters:
level jdbc connection checking level (0, 1, or 2)

Definition at line 359 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcConnCheckLevel().

void org.objectweb.jonas.dbm.Pool.setMaxAge int  mn  ) 
 

Parameters:
mn max age of connection in minutes

Definition at line 240 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcConnMaxAge().

void org.objectweb.jonas.dbm.Pool.setMaxOpenTime int  mn  ) 
 

Parameters:
mn max time of open connection in minutes

Definition at line 273 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcMaxOpenTime().

void org.objectweb.jonas.dbm.Pool.setMaxWaiters int  nb  ) 
 

Parameters:
nb max nb of waiters

Definition at line 313 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcMaxWaiters().

void org.objectweb.jonas.dbm.Pool.setMaxWaitTime int  sec  ) 
 

Parameters:
sec max time to wait for a connection, in seconds

Definition at line 294 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcMaxWaitTime().

synchronized void org.objectweb.jonas.dbm.Pool.setPoolMax int  max  ) 
 

Parameters:
max max pool size. -1 means "no limit".

Definition at line 194 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcMaxConnPool().

synchronized void org.objectweb.jonas.dbm.Pool.setPoolMin int  min  ) 
 

Parameters:
min minimum connection pool size to be set.

Definition at line 171 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcMinConnPool().

void org.objectweb.jonas.dbm.Pool.setSamplingPeriod int  sec  ) 
 

Parameters:
sec sampling period in sec.

Definition at line 332 of file Pool.java.

References org.objectweb.jonas.dbm.PoolKeeper.setSamplingPeriod().

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcSamplingPeriod().

Here is the call graph for this function:

void org.objectweb.jonas.dbm.Pool.setTestStatement String  s  ) 
 

Parameters:
s test statement

Definition at line 378 of file Pool.java.

Referenced by org.objectweb.jonas.dbm.ConnectionManager.poolConfigure(), and org.objectweb.jonas.dbm.JDBCDataSource.setJdbcTestStatement().


The documentation for this class was generated from the following file:
Generated on Tue Feb 15 15:06:46 2005 for JOnAS by  doxygen 1.3.9.1