|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jonas.management.ReconfigDispatcher
org.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
Field Summary |
Fields inherited from class org.objectweb.jonas.management.ReconfigDispatcher |
RECONFIG_TYPE, SAVE_RECONFIG_TYPE |
Constructor Summary | |
ConnectionManager()
Constructor for Factory |
|
ConnectionManager(boolean isClient)
Constructor for the client case |
Method Summary | |
java.lang.String |
_getDSName()
|
void |
_setDSName(java.lang.String s)
|
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.Integer |
getCurrentNumberOfJDBCConnectionOpen()
MBean method: |
java.lang.String |
getDataSourceDescription()
MBean Method: |
java.lang.String |
getDataSourceFactory()
MBean method: |
java.lang.String |
getDatasourceName()
|
java.lang.String |
getDataSourceType()
Mbean Method: return the type of this data source |
java.lang.String |
getDataSourceXADataName()
MBean method: |
java.lang.String |
getDSName()
MBean method: |
java.lang.Integer |
getJDBCConnCheckLevel()
MBean method: |
java.lang.Integer |
getJDBCConnMaxAge()
MBean method: |
java.lang.Integer |
getJDBCDeadLockPool()
MBean method: |
java.lang.Integer |
getJDBCLoopWaitPool()
MBean method: |
java.lang.Integer |
getJDBCMaxConnPool()
MBean method: |
java.lang.Integer |
getJDBCMinConnPool()
MBean method: |
java.lang.Integer |
getJDBCSleepTimeOut()
MBean method: |
java.lang.String |
getJDBCTestStatement()
MBean method: |
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()
|
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
static org.objectweb.transaction.api.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 connteststmt,
java.lang.String minconpool,
java.lang.String maxconpool)
Configure the Connection pool. |
void |
saveConfig()
save updated configuration |
void |
setClassName(java.lang.String s)
|
void |
setDataSourceDescription(java.lang.String dsDesc)
Management Method: |
void |
setDatasourceName(java.lang.String s)
|
void |
setDataSourceXADataName(java.lang.String xaName)
Management method: |
void |
setDSName(java.lang.String s)
|
void |
setJDBCConnCheckLevel(java.lang.Integer level)
MBean method allowing to set the JDBC connection checking level value |
void |
setJDBCConnMaxAge(java.lang.Integer age)
MBean method allowing to set the JDBC connection maximum age |
void |
setJDBCDeadLockPool(java.lang.Integer size)
MBean method: do nothing |
void |
setJDBCLoopWaitPool(java.lang.Integer size)
MBean method: do nothing |
void |
setJDBCMaxConnPool(java.lang.Integer max)
MBean method allowing to set the maximum size of connection pool |
void |
setJDBCMinConnPool(java.lang.Integer min)
MBean method allowing to set the minimum size of connection pool |
void |
setJDBCSleepTimeOut(java.lang.Integer timeOut)
MBean method: do nothing |
void |
setJDBCTestStatement(java.lang.String test)
MBean method allowing to set the SQL query for test statement |
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.api.ResourceManagerEventListener rmel)
|
void |
setTransactionIsolation(java.lang.String level)
|
void |
setUrl(java.lang.String s)
|
void |
setUserName(java.lang.String s)
|
Methods inherited from class org.objectweb.jonas.management.ReconfigDispatcher |
addNotificationListener, getFilter, getHandback, getListener, getNotificationInfo, initLogger, removeNotificationListener, sendReconfigNotification, sendSaveNotification |
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 boolean isClientCase()
public void setRMEListener(org.objectweb.transaction.api.ResourceManagerEventListener rmel)
public java.lang.String _getDSName()
public void _setDSName(java.lang.String s)
s
- jndi name for the datasourcepublic java.lang.String getUrl()
getUrl
in interface JmxDataSourceMBean
public void setUrl(java.lang.String s)
public java.lang.String getClassName()
getClassName
in interface JmxDataSourceMBean
public void setClassName(java.lang.String s) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.String getUserName()
getUserName
in interface JmxDataSourceMBean
public void setUserName(java.lang.String s)
public java.lang.String getPassword()
getPassword
in interface JmxDataSourceMBean
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)
setMapperName
in interface ConnectionManagerMBean
public java.lang.String getMapperName()
getMapperName
in interface ConnectionManagerMBean
public void poolConfigure(java.lang.String connchecklevel, java.lang.String connmaxage, java.lang.String connteststmt, java.lang.String minconpool, java.lang.String maxconpool) throws ServiceException
connchecklevel
- JDBC connection checking levelconnmaxage
- JDBC connection maximum ageconnteststmt
- SQL query for test statementminconpool
- Min size for the connection poolmaxconpool
- Max size for the connection pool
ServiceException
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.api.ResourceManagerEventListener getResourceManagerEventListener()
public java.lang.Integer getCurrentNumberOfJDBCConnectionOpen()
getCurrentNumberOfJDBCConnectionOpen
in interface JmxDataSourceMBean
public java.lang.String getDSName()
getDSName
in interface JmxDataSourceMBean
public void setDSName(java.lang.String s)
s
- Jndi name of the datasourcepublic java.lang.String getDatasourceName()
getDatasourceName
in interface JmxDataSourceMBean
public void setDatasourceName(java.lang.String s)
s
- datasource namepublic java.lang.String getDataSourceFactory()
getDataSourceFactory
in interface JmxDataSourceMBean
public void setDataSourceXADataName(java.lang.String xaName)
public java.lang.String getDataSourceXADataName()
getDataSourceXADataName
in interface JmxDataSourceMBean
public java.lang.Integer getJDBCConnCheckLevel()
getJDBCConnCheckLevel
in interface JmxDataSourceMBean
public void setJDBCConnCheckLevel(java.lang.Integer level)
setJDBCConnCheckLevel
in interface JmxDataSourceMBean
public java.lang.Integer getJDBCConnMaxAge()
getJDBCConnMaxAge
in interface JmxDataSourceMBean
public void setJDBCConnMaxAge(java.lang.Integer age)
setJDBCConnMaxAge
in interface JmxDataSourceMBean
public java.lang.Integer getJDBCMinConnPool()
getJDBCMinConnPool
in interface JmxDataSourceMBean
public void setJDBCMinConnPool(java.lang.Integer min)
setJDBCMinConnPool
in interface JmxDataSourceMBean
min
- for connection poolpublic java.lang.Integer getJDBCMaxConnPool()
getJDBCMaxConnPool
in interface JmxDataSourceMBean
public void setJDBCMaxConnPool(java.lang.Integer max)
setJDBCMaxConnPool
in interface JmxDataSourceMBean
max
- for connection poolpublic java.lang.String getJDBCTestStatement()
getJDBCTestStatement
in interface JmxDataSourceMBean
public void setJDBCTestStatement(java.lang.String test)
setJDBCTestStatement
in interface JmxDataSourceMBean
test
- statementpublic java.lang.String getDataSourceType()
getDataSourceType
in interface JmxDataSourceMBean
public java.lang.String getDataSourceDescription()
getDataSourceDescription
in interface JmxDataSourceMBean
public void setDataSourceDescription(java.lang.String dsDesc)
public java.lang.Integer getJDBCSleepTimeOut()
getJDBCSleepTimeOut
in interface JmxDataSourceMBean
public void setJDBCSleepTimeOut(java.lang.Integer timeOut)
setJDBCSleepTimeOut
in interface JmxDataSourceMBean
public java.lang.Integer getJDBCDeadLockPool()
getJDBCDeadLockPool
in interface JmxDataSourceMBean
public void setJDBCDeadLockPool(java.lang.Integer size)
setJDBCDeadLockPool
in interface JmxDataSourceMBean
size
- public java.lang.Integer getJDBCLoopWaitPool()
getJDBCLoopWaitPool
in interface JmxDataSourceMBean
public void setJDBCLoopWaitPool(java.lang.Integer size)
setJDBCLoopWaitPool
in interface JmxDataSourceMBean
size
- public void saveConfig()
saveConfig
in interface ConnectionManagerMBean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |