|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jonas.dbm.ConnectionManager
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)
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)
Constructor Summary | |
ConnectionManager()
Constructor for Factory |
|
ConnectionManager(boolean isClient)
Constructor for the client case |
Method Summary | |
void |
closeAllConnection()
|
void |
connectionClosed(javax.sql.ConnectionEvent event)
Invoked when the application calls close() on its representation of the connection. |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
Invoked when a fatal connection error occurs, just before an SQLException is thrown to the application. |
java.lang.String |
getClassName()
|
java.sql.Connection |
getConnection()
Attempt to establish a database connection. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Attempt to establish a database connection. |
static ConnectionManager |
getConnectionManager(java.lang.String dsname)
get the ConnectionManager matching the DataSource name |
java.lang.String |
getDataSourceDescription()
|
java.lang.String |
getDatasourceName()
|
java.lang.String |
getDSName()
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
java.io.PrintWriter |
getLogWriter()
Get the log writer for this data source. |
java.lang.String |
getMapperName()
|
java.lang.String |
getPassword()
|
Pool |
getPool()
|
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
static org.objectweb.transaction.jta.ResourceManagerEventListener |
getResourceManagerEventListener()
|
java.lang.String |
getTransactionIsolation()
|
java.lang.String |
getUrl()
|
java.lang.String |
getUserName()
|
boolean |
isClientCase()
This manager is in the client case or not ? |
void |
poolConfigure(java.lang.String connchecklevel,
java.lang.String connmaxage,
java.lang.String maxopentime,
java.lang.String connteststmt,
java.lang.String minconpool,
java.lang.String maxconpool,
java.lang.String maxwaittime,
java.lang.String maxwaiters,
java.lang.String samplingperiod)
Configure the Connection pool. |
void |
setClassName(java.lang.String s)
|
void |
setDataSourceDescription(java.lang.String dsDesc)
|
void |
setDatasourceName(java.lang.String s)
|
void |
setDSName(java.lang.String s)
|
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |
void |
setLogWriter(java.io.PrintWriter out)
Set the log writer for this data source. |
void |
setMapperName(java.lang.String mappername)
|
void |
setPassword(java.lang.String s)
|
void |
setRMEListener(org.objectweb.transaction.jta.ResourceManagerEventListener rmel)
|
void |
setTransactionIsolation(java.lang.String level)
|
void |
setUrl(java.lang.String s)
|
void |
setUserName(java.lang.String s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConnectionManager() throws java.lang.Exception
public ConnectionManager(boolean isClient) throws java.lang.Exception
isClient
- true if this is the client case
TODO : must be removed. A client can lookup a datasourceMethod Detail |
public Pool getPool()
public boolean isClientCase()
public void setRMEListener(org.objectweb.transaction.jta.ResourceManagerEventListener rmel)
public java.lang.String getDSName()
public void setDSName(java.lang.String s)
s
- Jndi name for the datasourcepublic java.lang.String getUrl()
public void setUrl(java.lang.String s)
public java.lang.String getClassName()
public void setClassName(java.lang.String s) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.String getUserName()
public void setUserName(java.lang.String s)
public java.lang.String getPassword()
public void setPassword(java.lang.String s)
public void setTransactionIsolation(java.lang.String level)
public java.lang.String getTransactionIsolation()
public void setMapperName(java.lang.String mappername)
public java.lang.String getMapperName()
public void poolConfigure(java.lang.String connchecklevel, java.lang.String connmaxage, java.lang.String maxopentime, java.lang.String connteststmt, java.lang.String minconpool, java.lang.String maxconpool, java.lang.String maxwaittime, java.lang.String maxwaiters, java.lang.String samplingperiod)
connchecklevel
- JDBC connection checking levelconnmaxage
- JDBC connection maximum agemaxopentime
- JDBC connection maximum open timeconnteststmt
- SQL query for test statementminconpool
- Min size for the connection poolmaxconpool
- Max size for the connection poolmaxwaittime
- Max time to wait for a connection (in seconds)maxwaiters
- Max nb of waiters for a connectionsamplingperiod
- sampling period in sec.public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- - if a database-access error occurs.public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
password
- - the user's password
java.sql.SQLException
- - if a database-access error occurs.public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
- - if a database-access error occurs.public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
setLogWriter
in interface javax.sql.DataSource
out
- - the new log writer; to disable, set to null
java.sql.SQLException
- - if a database-access error occurs.public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
seconds
- - the data source login time limit
java.sql.SQLException
- - if a database access error occurs.public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
- - if a database access error occurs.public void connectionClosed(javax.sql.ConnectionEvent event)
connectionClosed
in interface javax.sql.ConnectionEventListener
event
- - an event object describing the source of the eventpublic void connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred
in interface javax.sql.ConnectionEventListener
event
- - an event object describing the source of the eventpublic javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
- If a naming exception was encountered while
retrieving the reference.public static ConnectionManager getConnectionManager(java.lang.String dsname)
public void closeAllConnection()
public static org.objectweb.transaction.jta.ResourceManagerEventListener getResourceManagerEventListener()
public java.lang.String getDatasourceName()
public void setDatasourceName(java.lang.String s)
s
- datasource namepublic java.lang.String getDataSourceDescription()
public void setDataSourceDescription(java.lang.String dsDesc)
dsDesc
- the desrciption of this datasource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |