|
||||||||||
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 | |
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.Integer |
getBusyMaxRecent()
MBean method: |
java.lang.Integer |
getBusyMinRecent()
MBean method: |
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. |
java.lang.Integer |
getConnectionFailures()
MBean method: |
java.lang.Integer |
getConnectionLeaks()
MBean method: |
static ConnectionManager |
getConnectionManager(java.lang.String dsname)
get the ConnectionManager matching the DataSource name |
java.lang.Integer |
getCurrentBusy()
MBean method: |
java.lang.Integer |
getCurrentInTx()
MBean method: |
java.lang.Integer |
getCurrentOpened()
MBean method: |
java.lang.Integer |
getCurrentWaiters()
MBean method: |
java.lang.String |
getDataSourceDescription()
MBean Method: |
java.lang.String |
getDatasourceName()
|
java.lang.String |
getDataSourceType()
Mbean Method: return the type of this data source |
java.lang.String |
getDSName()
MBean method: |
java.lang.Integer |
getJDBCConnCheckLevel()
MBean method: |
java.lang.Integer |
getJDBCConnMaxAge()
MBean method: |
java.lang.Integer |
getJDBCMaxConnPool()
MBean method: |
java.lang.Integer |
getJDBCMaxOpenTime()
MBean method: |
java.lang.Integer |
getJDBCMaxWaiters()
MBean method: |
java.lang.Integer |
getJDBCMaxWaitTime()
MBean method: |
java.lang.Integer |
getJDBCMinConnPool()
MBean method: |
java.lang.Integer |
getJDBCSamplingPeriod()
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.Integer |
getOpenedCount()
MBean method: |
java.lang.String |
getPassword()
|
Pool |
getPool()
|
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
java.lang.Integer |
getRejectedFull()
Management method: |
java.lang.Integer |
getRejectedOpen()
Management method: |
java.lang.Integer |
getRejectedOther()
Management method: |
java.lang.Integer |
getRejectedTimeout()
Management method: |
static org.objectweb.transaction.api.ResourceManagerEventListener |
getResourceManagerEventListener()
|
java.lang.Integer |
getServedOpen()
Management method: |
java.lang.String |
getTransactionIsolation()
|
java.lang.String |
getUrl()
|
java.lang.String |
getUserName()
|
java.lang.Integer |
getWaiterCount()
MBean method: |
java.lang.Integer |
getWaitersHigh()
MBean method: |
java.lang.Integer |
getWaitersHighRecent()
MBean method: |
java.lang.Long |
getWaitingHigh()
MBean method: |
java.lang.Long |
getWaitingHighRecent()
MBean method: |
java.lang.Long |
getWaitingTime()
MBean method: |
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 |
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 |
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 mn)
MBean method allowing to set the JDBC connection maximum age |
void |
setJDBCMaxConnPool(java.lang.Integer max)
MBean method allowing to set the maximum size of connection pool |
void |
setJDBCMaxOpenTime(java.lang.Integer mn)
MBean method allowing to set the JDBC connection max open time |
void |
setJDBCMaxWaiters(java.lang.Integer max)
MBean method allowing to set the maximum nb of concurrent waiters for a JDBC Connection. |
void |
setJDBCMaxWaitTime(java.lang.Integer max)
MBean method allowing to set the maximum time to wait for a connection |
void |
setJDBCMinConnPool(java.lang.Integer min)
MBean method allowing to set the minimum size of connection pool |
void |
setJDBCSamplingPeriod(java.lang.Integer i)
MBean method allowing to set the sampling period |
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)
Set the Mapper Name |
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 Pool getPool()
public boolean isClientCase()
public void setRMEListener(org.objectweb.transaction.api.ResourceManagerEventListener rmel)
public void setDSName(java.lang.String s)
s
- jndi name for the datasourcepublic java.lang.String getUrl()
getUrl
in interface ConnectionManagerMBean
public void setUrl(java.lang.String s)
public java.lang.String getClassName()
getClassName
in interface ConnectionManagerMBean
public void setClassName(java.lang.String s) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.String getUserName()
getUserName
in interface ConnectionManagerMBean
public void setUserName(java.lang.String s)
public java.lang.String getPassword()
getPassword
in interface ConnectionManagerMBean
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)
ConnectionManagerMBean
setMapperName
in interface ConnectionManagerMBean
mappername
- mapper namepublic java.lang.String getMapperName()
getMapperName
in interface ConnectionManagerMBean
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.api.ResourceManagerEventListener getResourceManagerEventListener()
public java.lang.Integer getCurrentOpened()
getCurrentOpened
in interface ConnectionManagerMBean
public java.lang.Integer getCurrentBusy()
getCurrentBusy
in interface ConnectionManagerMBean
public java.lang.Integer getOpenedCount()
getOpenedCount
in interface ConnectionManagerMBean
public java.lang.Integer getConnectionFailures()
getConnectionFailures
in interface ConnectionManagerMBean
public java.lang.Integer getConnectionLeaks()
getConnectionLeaks
in interface ConnectionManagerMBean
public java.lang.Integer getServedOpen()
getServedOpen
in interface ConnectionManagerMBean
public java.lang.Integer getRejectedOpen()
getRejectedOpen
in interface ConnectionManagerMBean
public java.lang.Integer getRejectedFull()
getRejectedFull
in interface ConnectionManagerMBean
public java.lang.Integer getRejectedTimeout()
getRejectedTimeout
in interface ConnectionManagerMBean
public java.lang.Integer getRejectedOther()
getRejectedOther
in interface ConnectionManagerMBean
public java.lang.Integer getCurrentWaiters()
getCurrentWaiters
in interface ConnectionManagerMBean
public java.lang.Integer getWaitersHigh()
getWaitersHigh
in interface ConnectionManagerMBean
public java.lang.Integer getWaitersHighRecent()
getWaitersHighRecent
in interface ConnectionManagerMBean
public java.lang.Integer getBusyMaxRecent()
getBusyMaxRecent
in interface ConnectionManagerMBean
public java.lang.Integer getBusyMinRecent()
getBusyMinRecent
in interface ConnectionManagerMBean
public java.lang.Integer getWaiterCount()
getWaiterCount
in interface ConnectionManagerMBean
public java.lang.Long getWaitingTime()
getWaitingTime
in interface ConnectionManagerMBean
public java.lang.Long getWaitingHigh()
getWaitingHigh
in interface ConnectionManagerMBean
public java.lang.Long getWaitingHighRecent()
getWaitingHighRecent
in interface ConnectionManagerMBean
public java.lang.Integer getCurrentInTx()
getCurrentInTx
in interface ConnectionManagerMBean
public java.lang.String getDSName()
getDSName
in interface ConnectionManagerMBean
public java.lang.String getDatasourceName()
getDatasourceName
in interface ConnectionManagerMBean
public void setDatasourceName(java.lang.String s)
s
- datasource namepublic java.lang.Integer getJDBCConnCheckLevel()
getJDBCConnCheckLevel
in interface ConnectionManagerMBean
public void setJDBCConnCheckLevel(java.lang.Integer level)
setJDBCConnCheckLevel
in interface ConnectionManagerMBean
level
- connection levelpublic java.lang.Integer getJDBCConnMaxAge()
getJDBCConnMaxAge
in interface ConnectionManagerMBean
public void setJDBCConnMaxAge(java.lang.Integer mn)
setJDBCConnMaxAge
in interface ConnectionManagerMBean
mn
- connection max agepublic java.lang.Integer getJDBCMaxOpenTime()
getJDBCMaxOpenTime
in interface ConnectionManagerMBean
public void setJDBCMaxOpenTime(java.lang.Integer mn)
setJDBCMaxOpenTime
in interface ConnectionManagerMBean
mn
- connection max open time in minutespublic java.lang.Integer getJDBCMinConnPool()
getJDBCMinConnPool
in interface ConnectionManagerMBean
public void setJDBCMinConnPool(java.lang.Integer min)
setJDBCMinConnPool
in interface ConnectionManagerMBean
min
- public java.lang.Integer getJDBCMaxConnPool()
getJDBCMaxConnPool
in interface ConnectionManagerMBean
public void setJDBCMaxConnPool(java.lang.Integer max)
setJDBCMaxConnPool
in interface ConnectionManagerMBean
max
- public java.lang.String getJDBCTestStatement()
getJDBCTestStatement
in interface ConnectionManagerMBean
public void setJDBCTestStatement(java.lang.String test)
setJDBCTestStatement
in interface ConnectionManagerMBean
test
- statementpublic java.lang.Integer getJDBCMaxWaitTime()
getJDBCMaxWaitTime
in interface ConnectionManagerMBean
public void setJDBCMaxWaitTime(java.lang.Integer max)
setJDBCMaxWaitTime
in interface ConnectionManagerMBean
max
- public java.lang.Integer getJDBCMaxWaiters()
getJDBCMaxWaiters
in interface ConnectionManagerMBean
public void setJDBCMaxWaiters(java.lang.Integer max)
setJDBCMaxWaiters
in interface ConnectionManagerMBean
max
- public java.lang.Integer getJDBCSamplingPeriod()
getJDBCSamplingPeriod
in interface ConnectionManagerMBean
public void setJDBCSamplingPeriod(java.lang.Integer i)
setJDBCSamplingPeriod
in interface ConnectionManagerMBean
i
- public java.lang.String getDataSourceType()
getDataSourceType
in interface ConnectionManagerMBean
public java.lang.String getDataSourceDescription()
getDataSourceDescription
in interface ConnectionManagerMBean
public void setDataSourceDescription(java.lang.String dsDesc)
dsDesc
- the desrciption of this datasourcepublic void saveConfig()
saveConfig
in interface ConnectionManagerMBean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |