|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.jonas.dbm.internal.cm.ConnectionManager
public class ConnectionManager
DataSource implementation. Manage a pool of connections.
| Constructor Summary | |
|---|---|
ConnectionManager()
Deprecated. |
|
ConnectionManager(boolean isClient)
Always called with true |
|
ConnectionManager(TransactionService txs)
|
|
| Method Summary | |
|---|---|
void |
adjust()
Adjust the pool size, according to poolMax and poolMin values. |
String |
checkConnection(String testStatement)
Check on a connection the test statement |
void |
closeAllConnection()
Close all connections in the pool, when server is shut down. |
void |
connectionClosed(ConnectionEvent event)
|
void |
connectionErrorOccurred(ConnectionEvent event)
|
void |
freeConnections(Transaction tx)
The transaction has committed (or rolled back). |
int |
getAdjustPeriod()
|
int |
getBusyMaxRecent()
|
int |
getBusyMinRecent()
|
int |
getCheckLevel()
|
String |
getClassName()
|
Connection |
getConnection()
|
Connection |
getConnection(String username,
String password)
Attempts to establish a connection with the data source that this DataSource object represents. |
int |
getConnectionFailures()
|
int |
getConnectionLeaks()
|
static ConnectionManager |
getConnectionManager(String dsname)
get the ConnectionManager matching the DataSource name |
int |
getCurrentBusy()
|
int |
getCurrentInTx()
|
int |
getCurrentOpened()
|
int |
getCurrentWaiters()
|
String |
getDataSourceDescription()
|
String |
getDatasourceName()
|
String |
getDSName()
|
int |
getLoginTimeout()
|
PrintWriter |
getLogWriter()
|
String |
getMapperName()
|
int |
getMaxAge()
|
long |
getMaxAgeMilli()
|
int |
getMaxOpenTime()
|
long |
getMaxOpenTimeMilli()
|
int |
getMaxWaiters()
|
int |
getMaxWaitTime()
|
int |
getOpenedCount()
|
String |
getPassword()
|
Pool |
getPool()
|
int |
getPoolMax()
|
int |
getPoolMin()
|
int |
getPstmtMax()
|
Reference |
getReference()
Retrieves the Reference of this object. |
int |
getRejectedFull()
|
int |
getRejectedOpen()
|
int |
getRejectedOther()
|
int |
getRejectedTimeout()
|
int |
getSamplingPeriod()
|
int |
getServedOpen()
|
String |
getTestStatement()
|
String |
getTransactionIsolation()
|
String |
getUrl()
|
String |
getUserName()
|
int |
getWaiterCount()
|
int |
getWaitersHigh()
|
int |
getWaitersHighRecent()
|
long |
getWaitingHigh()
|
long |
getWaitingHighRecent()
|
long |
getWaitingTime()
|
XAConnection |
getXAConnection()
|
XAConnection |
getXAConnection(String user,
String passwd)
Attempts to establish a physical database connection, using the given user name and password. |
boolean |
isClientCase()
This manager is in the client case or not ? |
JManagedConnection |
openConnection(String user,
Transaction tx)
lookup connection in the pool for this user/tx |
void |
poolConfigure(String connchecklevel,
String connmaxage,
String maxopentime,
String connteststmt,
String pstmtmax,
String minconpool,
String maxconpool,
String maxwaittime,
String maxwaiters,
String samplingperiod,
String adjustperiod)
Configure the Connection pool. |
void |
recomputeBusy()
compute current min/max busyConnections |
void |
sampling()
make samples with some monitoring values |
void |
setAdjustPeriod(int sec)
|
void |
setCheckLevel(int level)
|
void |
setClassName(String s)
|
void |
setDataSourceDescription(String dsDesc)
|
void |
setDatasourceName(String s)
|
void |
setDSName(String s)
|
void |
setLoginTimeout(int seconds)
|
void |
setLogWriter(PrintWriter out)
|
void |
setMapperName(String mappername)
|
void |
setMaxAge(int mn)
|
void |
setMaxOpenTime(int mn)
|
void |
setMaxWaiters(int nb)
|
void |
setMaxWaitTime(int sec)
|
void |
setPassword(String s)
|
void |
setPoolMax(int max)
|
void |
setPoolMin(int min)
|
void |
setPstmtMax(int nb)
|
void |
setSamplingPeriod(int sec)
|
void |
setTestStatement(String s)
|
void |
setTransactionIsolation(String level)
|
void |
setUrl(String s)
|
void |
setUserName(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 Exception
Exception
public ConnectionManager(boolean isClient)
throws Exception
Exception
public ConnectionManager(TransactionService txs)
throws Exception
Exception| Method Detail |
|---|
public boolean isClientCase()
public Pool getPool()
public static ConnectionManager getConnectionManager(String dsname)
public String getDSName()
public void setDSName(String s)
s - Jndi name for the datasourcepublic String getDatasourceName()
public void setDatasourceName(String s)
public String getUrl()
public void setUrl(String s)
public String getClassName()
public void setClassName(String s)
throws ClassNotFoundException
ClassNotFoundExceptionpublic String getUserName()
public void setUserName(String s)
public String getPassword()
public void setPassword(String s)
public void setTransactionIsolation(String level)
public String getTransactionIsolation()
public void setMapperName(String mappername)
public String getMapperName()
public String getDataSourceDescription()
public void setDataSourceDescription(String dsDesc)
dsDesc - the desrciption of this datasourcepublic int getPoolMin()
getPoolMin in interface Poolpublic void setPoolMin(int min)
setPoolMin in interface Poolmin - minimum connection pool size to be set.public int getPoolMax()
getPoolMax in interface Poolpublic void setPoolMax(int max)
setPoolMax in interface Poolmax - max pool size. -1 means "no limit".public int getMaxAge()
getMaxAge in interface Poolpublic long getMaxAgeMilli()
getMaxAgeMilli in interface Poolpublic void setMaxAge(int mn)
setMaxAge in interface Poolmn - max age of connection in minutespublic int getMaxOpenTime()
getMaxOpenTime in interface Poolpublic long getMaxOpenTimeMilli()
getMaxOpenTimeMilli in interface Poolpublic void setMaxOpenTime(int mn)
setMaxOpenTime in interface Poolmn - max time of open connection in minutespublic int getMaxWaitTime()
getMaxWaitTime in interface Poolpublic void setMaxWaitTime(int sec)
setMaxWaitTime in interface Poolsec - max time to wait for a connection, in secondspublic int getMaxWaiters()
getMaxWaiters in interface Poolpublic void setMaxWaiters(int nb)
setMaxWaiters in interface Poolnb - max nb of waiterspublic int getSamplingPeriod()
getSamplingPeriod in interface Poolpublic void setSamplingPeriod(int sec)
setSamplingPeriod in interface Poolsec - sampling period in sec.public int getAdjustPeriod()
getAdjustPeriod in interface Poolpublic void setAdjustPeriod(int sec)
setAdjustPeriod in interface Poolsec - adjust period in sec.public int getCheckLevel()
getCheckLevel in interface Poolpublic void setCheckLevel(int level)
setCheckLevel in interface Poollevel - jdbc connection checking level (0, 1, or 2)public int getPstmtMax()
public void setPstmtMax(int nb)
nb - PreparedStatement cache sizepublic String getTestStatement()
getTestStatement in interface Poolpublic void setTestStatement(String s)
setTestStatement in interface Pools - test statement
public void poolConfigure(String connchecklevel,
String connmaxage,
String maxopentime,
String connteststmt,
String pstmtmax,
String minconpool,
String maxconpool,
String maxwaittime,
String maxwaiters,
String samplingperiod,
String adjustperiod)
connchecklevel - JDBC connection checking levelconnmaxage - JDBC connection maximum agemaxopentime - JDBC connection maximum open timeconnteststmt - SQL query for test statementpstmtmax - prepare statement pool size per managed connectionminconpool - 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.adjustperiod - pool adjust period in sec.public int getBusyMaxRecent()
getBusyMaxRecent in interface Poolpublic int getBusyMinRecent()
getBusyMinRecent in interface Poolpublic int getCurrentWaiters()
getCurrentWaiters in interface Poolpublic int getOpenedCount()
getOpenedCount in interface Poolpublic int getConnectionFailures()
getConnectionFailures in interface Poolpublic int getConnectionLeaks()
getConnectionLeaks in interface Poolpublic int getServedOpen()
getServedOpen in interface Poolpublic int getRejectedFull()
getRejectedFull in interface Poolpublic int getRejectedTimeout()
getRejectedTimeout in interface Poolpublic int getRejectedOther()
getRejectedOther in interface Poolpublic int getRejectedOpen()
getRejectedOpen in interface Poolpublic int getWaitersHigh()
getWaitersHigh in interface Poolpublic int getWaitersHighRecent()
getWaitersHighRecent in interface Poolpublic int getWaiterCount()
getWaiterCount in interface Poolpublic long getWaitingTime()
getWaitingTime in interface Poolpublic long getWaitingHigh()
getWaitingHigh in interface Poolpublic long getWaitingHighRecent()
getWaitingHighRecent in interface Pool
public int getLoginTimeout()
throws SQLException
getLoginTimeout in interface DataSourcegetLoginTimeout in interface XADataSourceSQLException
public void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface DataSourcesetLoginTimeout in interface XADataSourceSQLException
public PrintWriter getLogWriter()
throws SQLException
getLogWriter in interface DataSourcegetLogWriter in interface XADataSourceSQLException
public void setLogWriter(PrintWriter out)
throws SQLException
setLogWriter in interface DataSourcesetLogWriter in interface XADataSourceSQLException
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceSQLException
public Connection getConnection(String username,
String password)
throws SQLException
getConnection in interface DataSourceusername - - the database user on whose behalf the connection is being madepassword - - the user's password
SQLException - - if a database access error occurs
public XAConnection getXAConnection()
throws SQLException
getXAConnection in interface XADataSourceSQLException
public XAConnection getXAConnection(String user,
String passwd)
throws SQLException
getXAConnection in interface XADataSourceuser - - the database user on whose behalf the connection is being madepasswd - - the user's password
SQLException - - if a database access error occurs
public Reference getReference()
throws NamingException
getReference in interface ReferenceableNamingException - If a naming exception was encountered while
retrieving the reference.public void connectionClosed(ConnectionEvent event)
connectionClosed in interface ConnectionEventListenerpublic void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred in interface ConnectionEventListenerpublic int getCurrentOpened()
getCurrentOpened in interface Poolpublic int getCurrentBusy()
getCurrentBusy in interface Poolpublic void recomputeBusy()
public int getCurrentInTx()
getCurrentInTx in interface Poolpublic void sampling()
public void adjust()
public JManagedConnection openConnection(String user,
Transaction tx)
throws SQLException
user - user nametx - Transaction the connection is involved
SQLException - Cannot open a connection because the pool's max size is reachedpublic void freeConnections(Transaction tx)
tx - the non null transactionpublic void closeAllConnection()
public String checkConnection(String testStatement)
throws SQLException
checkConnection in interface PooltestStatement - the statement to use for test
SQLException - If an error occured when trying to test (not due to the test itself,
but to other preliminary or post operation).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||