org.objectweb.jonas.dbm.ConnectionManager Class Reference

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

Pool getPool ()
 ConnectionManager () throws Exception
 ConnectionManager (boolean isClient) throws Exception
boolean isClientCase ()
String getDSName ()
void setDSName (String s)
void poolConfigure (String connchecklevel, String connmaxage, String maxopentime, String connteststmt, String minconpool, String maxconpool, String maxwaittime, String maxwaiters, String samplingperiod)
Connection getConnection () throws SQLException
Connection getConnection (String username, String password) throws SQLException
java.io.PrintWriter getLogWriter () throws SQLException
void setLogWriter (java.io.PrintWriter out) throws SQLException
void setLoginTimeout (int seconds) throws SQLException
int getLoginTimeout () throws SQLException
void connectionClosed (ConnectionEvent event)
void connectionErrorOccurred (ConnectionEvent event)
Reference getReference () throws NamingException
String getDatasourceName ()
void setDatasourceName (String s)
String getDataSourceDescription ()
void setDataSourceDescription (String dsDesc)
Integer getCurrentOpened ()

Static Public Member Functions

ConnectionManager getConnectionManager (String dsname)

Detailed Description

JOnAS generic implementation of DataSource to manage an underlying JDBC-XA driver (XADataSource, XAConnection, XAResource, ...) This class acts as a factory for Connection objects. Its main goal is to manage a pool of XAConnection objects, to avoid closing the actual Connection on DBMS, and to deal with distributed transactions. This DataSource is registered in JNDI (=> implements Referenceable)

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 cmList

Adriana Danes

03/01/13 - Manage datasource name additionally to the jndi name for the datasource using this ConnectionManager

03/04/08 - ConnectionManager extends ReconfigDispatcher in order to send reconfiguration Notifications to ReconfigManager

03/05/23 - Introduce pool size configuration

04/09/20 - Remove ReconfigDispatcher inheritance; management features moved to new MBeans (JSR77 JDBCDataSource, JDBCDriver)

Definition at line 86 of file ConnectionManager.java.


Constructor & Destructor Documentation

org.objectweb.jonas.dbm.ConnectionManager.ConnectionManager  )  throws Exception
 

Constructor for Factory

Definition at line 186 of file ConnectionManager.java.

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

Here is the call graph for this function:

org.objectweb.jonas.dbm.ConnectionManager.ConnectionManager boolean  isClient  )  throws Exception
 

Constructor for the client case

Parameters:
isClient true if this is the client case TODO : must be removed. A client can lookup a datasource

Definition at line 214 of file ConnectionManager.java.


Member Function Documentation

void org.objectweb.jonas.dbm.ConnectionManager.connectionClosed ConnectionEvent  event  ) 
 

Invoked when the application calls close() on its representation of the connection.

Parameters:
event - an event object describing the source of the event

Definition at line 539 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.Pool.closeConnection(), org.objectweb.jonas.dbm.PoolItem.isRME(), and org.objectweb.jonas.dbm.PoolItem.setRME().

Here is the call graph for this function:

void org.objectweb.jonas.dbm.ConnectionManager.connectionErrorOccurred ConnectionEvent  event  ) 
 

Invoked when a fatal connection error occurs, just before an SQLException is thrown to the application.

Parameters:
event - an event object describing the source of the event

Definition at line 559 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.Pool.closeConnection(), org.objectweb.jonas.dbm.PoolItem.isRME(), and org.objectweb.jonas.dbm.PoolItem.setRME().

Here is the call graph for this function:

Connection org.objectweb.jonas.dbm.ConnectionManager.getConnection String  username,
String  password
throws SQLException
 

Attempt to establish a database connection.

Parameters:
user - the database user on whose behalf the Connection is being made
password - the user's password
Returns:
a Connection to the database
Exceptions:
SQLException - if a database-access error occurs.

Definition at line 398 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.PoolItem.getOpenCount(), org.objectweb.jonas.dbm.PoolItem.getXACon(), org.objectweb.jonas.dbm.PoolItem.isRME(), org.objectweb.jonas.dbm.Pool.openConnection(), and org.objectweb.jonas.dbm.PoolItem.setRME().

Here is the call graph for this function:

Connection org.objectweb.jonas.dbm.ConnectionManager.getConnection  )  throws SQLException
 

Attempt to establish a database connection.

Returns:
a Connection to the database
Exceptions:
java.sql.SQLException - if a database-access error occurs.

Definition at line 384 of file ConnectionManager.java.

ConnectionManager org.objectweb.jonas.dbm.ConnectionManager.getConnectionManager String  dsname  )  [static]
 

get the ConnectionManager matching the DataSource name

Definition at line 622 of file ConnectionManager.java.

Integer org.objectweb.jonas.dbm.ConnectionManager.getCurrentOpened  ) 
 

Method called by the a management method in the dbm service MBean

Returns:
Integer number of open connection in this ds

Definition at line 668 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.Pool.getCurrentOpened().

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.getTotalCurrentNumberOfJDBCConnectionOpen().

Here is the call graph for this function:

String org.objectweb.jonas.dbm.ConnectionManager.getDataSourceDescription  ) 
 

Returns:
the desrciption of this datasource

Definition at line 654 of file ConnectionManager.java.

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

String org.objectweb.jonas.dbm.ConnectionManager.getDatasourceName  ) 
 

Returns:
datasource name

Definition at line 640 of file ConnectionManager.java.

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.isLoadedDataSource(), org.objectweb.jonas.dbm.JDBCDataSource.JDBCDataSource(), org.objectweb.jonas.dbm.Pool.openConnection(), and org.objectweb.jonas.dbm.DataBaseServiceImpl.unloadDataSource().

String org.objectweb.jonas.dbm.ConnectionManager.getDSName  ) 
 

Returns:
Jndi name of the datasource

Definition at line 240 of file ConnectionManager.java.

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.getConnectionManager(), org.objectweb.jonas.dbm.JDBCDataSource.getJndiName(), org.objectweb.jonas.dbm.ConnectionManager.getReference(), org.objectweb.jonas.dbm.DataBaseServiceImpl.unbindDataSources(), and org.objectweb.jonas.dbm.DataBaseServiceImpl.unloadDataSource().

int org.objectweb.jonas.dbm.ConnectionManager.getLoginTimeout  )  throws SQLException
 

Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise it means that there is no timeout. When a data source object is created the login timeout is initially zero.

Returns:
the data source login time limit
Exceptions:
SQLException - if a database access error occurs.

Definition at line 526 of file ConnectionManager.java.

java.io.PrintWriter org.objectweb.jonas.dbm.ConnectionManager.getLogWriter  )  throws SQLException
 

Get the log writer for this data source.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specificlog writer are not printed to the log writer associated with the Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.

Returns:
the log writer for this data source, null if disabled
Exceptions:
SQLException - if a database-access error occurs.

Definition at line 473 of file ConnectionManager.java.

Pool org.objectweb.jonas.dbm.ConnectionManager.getPool  ) 
 

Returns:
The pool associated to this datasource

Definition at line 119 of file ConnectionManager.java.

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

Reference org.objectweb.jonas.dbm.ConnectionManager.getReference  )  throws NamingException
 

Retrieves the Reference of this object. Used at binding time by JNDI to build a reference on this object.

Returns:
The non-null Reference of this object.
Exceptions:
NamingException If a naming exception was encountered while retrieving the reference.

Definition at line 586 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.Pool.getCheckLevel(), org.objectweb.jonas.dbm.ConnectionManager.getDSName(), org.objectweb.jonas.dbm.Pool.getMaxAge(), org.objectweb.jonas.dbm.Pool.getMaxOpenTime(), org.objectweb.jonas.dbm.Pool.getMaxWaiters(), org.objectweb.jonas.dbm.Pool.getMaxWaitTime(), org.objectweb.jonas.dbm.Pool.getPoolMax(), org.objectweb.jonas.dbm.Pool.getPoolMin(), org.objectweb.jonas.dbm.Pool.getSamplingPeriod(), and org.objectweb.jonas.dbm.Pool.getTestStatement().

Here is the call graph for this function:

boolean org.objectweb.jonas.dbm.ConnectionManager.isClientCase  ) 
 

This manager is in the client case or not ?

Returns:
boolean true if this is the client case TODO : must be removed. A client can lookup a datasource

Definition at line 225 of file ConnectionManager.java.

void org.objectweb.jonas.dbm.ConnectionManager.poolConfigure String  connchecklevel,
String  connmaxage,
String  maxopentime,
String  connteststmt,
String  minconpool,
String  maxconpool,
String  maxwaittime,
String  maxwaiters,
String  samplingperiod
 

Configure the Connection pool. Called by the Container at init. Configuration can be set in datasource.properties files.

Parameters:
connchecklevel JDBC connection checking level
connmaxage JDBC connection maximum age
maxopentime JDBC connection maximum open time
connteststmt SQL query for test statement
minconpool Min size for the connection pool
maxconpool Max size for the connection pool
maxwaittime Max time to wait for a connection (in seconds)
maxwaiters Max nb of waiters for a connection
samplingperiod sampling period in sec.
Exceptions:
ServiceException if could not create the initial items in the pool

Definition at line 338 of file ConnectionManager.java.

References org.objectweb.jonas.dbm.Pool.getMaxWaiters(), org.objectweb.jonas.dbm.Pool.getMaxWaitTime(), org.objectweb.jonas.dbm.Pool.getPoolMax(), org.objectweb.jonas.dbm.Pool.getPoolMin(), org.objectweb.jonas.dbm.Pool.getSamplingPeriod(), org.objectweb.jonas.dbm.Pool.setCheckLevel(), org.objectweb.jonas.dbm.Pool.setMaxAge(), org.objectweb.jonas.dbm.Pool.setMaxOpenTime(), org.objectweb.jonas.dbm.Pool.setMaxWaiters(), org.objectweb.jonas.dbm.Pool.setMaxWaitTime(), org.objectweb.jonas.dbm.Pool.setPoolMax(), org.objectweb.jonas.dbm.Pool.setPoolMin(), org.objectweb.jonas.dbm.Pool.setSamplingPeriod(), and org.objectweb.jonas.dbm.Pool.setTestStatement().

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.createDataSource().

Here is the call graph for this function:

void org.objectweb.jonas.dbm.ConnectionManager.setDataSourceDescription String  dsDesc  ) 
 

Parameters:
dsDesc the desrciption of this datasource

Definition at line 661 of file ConnectionManager.java.

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.createDataSource().

void org.objectweb.jonas.dbm.ConnectionManager.setDatasourceName String  s  ) 
 

Parameters:
s datasource name

Definition at line 647 of file ConnectionManager.java.

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.createDataSource().

void org.objectweb.jonas.dbm.ConnectionManager.setDSName String  s  ) 
 

Parameters:
s Jndi name for the datasource

Definition at line 247 of file ConnectionManager.java.

Referenced by org.objectweb.jonas.dbm.DataBaseServiceImpl.createDataSource().

void org.objectweb.jonas.dbm.ConnectionManager.setLoginTimeout int  seconds  )  throws SQLException
 

Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout. When a data source object is created the login timeout is initially zero.

Parameters:
seconds - the data source login time limit
Exceptions:
SQLException - if a database access error occurs.

Definition at line 511 of file ConnectionManager.java.

void org.objectweb.jonas.dbm.ConnectionManager.setLogWriter java.io.PrintWriter  out  )  throws SQLException
 

Set the log writer for this data source.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.

Parameters:
out - the new log writer; to disable, set to null
Exceptions:
SQLException - if a database-access error occurs.

Definition at line 494 of file ConnectionManager.java.


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