|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
forceCloseConnection(int connectionId)
|
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. |
Map |
getConnectionDetails(int connectionId)
|
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[] |
getOpenedConnections()
|
int[] |
getOpenedConnections(int usedTimeSec)
|
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 ? |
boolean |
isObservable()
|
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 |
setObservable(boolean observable)
|
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 |
---|
@Deprecated 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
ClassNotFoundException
public 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 Pool
public void setPoolMin(int min)
setPoolMin
in interface Pool
min
- minimum connection pool size to be set.public int getPoolMax()
getPoolMax
in interface Pool
public void setPoolMax(int max)
setPoolMax
in interface Pool
max
- max pool size. -1 means "no limit".public int getMaxAge()
getMaxAge
in interface Pool
public long getMaxAgeMilli()
getMaxAgeMilli
in interface Pool
public void setMaxAge(int mn)
setMaxAge
in interface Pool
mn
- max age of connection in minutespublic int getMaxOpenTime()
getMaxOpenTime
in interface Pool
public long getMaxOpenTimeMilli()
getMaxOpenTimeMilli
in interface Pool
public void setMaxOpenTime(int mn)
setMaxOpenTime
in interface Pool
mn
- max time of open connection in minutespublic int getMaxWaitTime()
getMaxWaitTime
in interface Pool
public void setMaxWaitTime(int sec)
setMaxWaitTime
in interface Pool
sec
- max time to wait for a connection, in secondspublic int getMaxWaiters()
getMaxWaiters
in interface Pool
public void setMaxWaiters(int nb)
setMaxWaiters
in interface Pool
nb
- max nb of waiterspublic int getSamplingPeriod()
getSamplingPeriod
in interface Pool
public void setSamplingPeriod(int sec)
setSamplingPeriod
in interface Pool
sec
- sampling period in sec.public int getAdjustPeriod()
getAdjustPeriod
in interface Pool
public void setAdjustPeriod(int sec)
setAdjustPeriod
in interface Pool
sec
- adjust period in sec.public int getCheckLevel()
getCheckLevel
in interface Pool
public void setCheckLevel(int level)
setCheckLevel
in interface Pool
level
- 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 Pool
public void setTestStatement(String s)
setTestStatement
in interface Pool
s
- test statementpublic boolean isObservable()
public void setObservable(boolean observable)
observable
- the observable to setpublic 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 Pool
public int getBusyMinRecent()
getBusyMinRecent
in interface Pool
public int getCurrentWaiters()
getCurrentWaiters
in interface Pool
public int getOpenedCount()
getOpenedCount
in interface Pool
public int getConnectionFailures()
getConnectionFailures
in interface Pool
public int getConnectionLeaks()
getConnectionLeaks
in interface Pool
public int getServedOpen()
getServedOpen
in interface Pool
public int getRejectedFull()
getRejectedFull
in interface Pool
public int getRejectedTimeout()
getRejectedTimeout
in interface Pool
public int getRejectedOther()
getRejectedOther
in interface Pool
public int getRejectedOpen()
getRejectedOpen
in interface Pool
public int getWaitersHigh()
getWaitersHigh
in interface Pool
public int getWaitersHighRecent()
getWaitersHighRecent
in interface Pool
public int getWaiterCount()
getWaiterCount
in interface Pool
public long getWaitingTime()
getWaitingTime
in interface Pool
public long getWaitingHigh()
getWaitingHigh
in interface Pool
public long getWaitingHighRecent()
getWaitingHighRecent
in interface Pool
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface DataSource
getLoginTimeout
in interface XADataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface DataSource
setLoginTimeout
in interface XADataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface DataSource
getLogWriter
in interface XADataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface DataSource
setLogWriter
in interface XADataSource
SQLException
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
username
- - the database user on whose behalf the connection is being madepassword
- - the user's password
SQLException
- - if a database access error occurspublic XAConnection getXAConnection() throws SQLException
getXAConnection
in interface XADataSource
SQLException
public XAConnection getXAConnection(String user, String passwd) throws SQLException
getXAConnection
in interface XADataSource
user
- - the database user on whose behalf the connection is being madepasswd
- - the user's password
SQLException
- - if a database access error occurspublic Reference getReference() throws NamingException
getReference
in interface Referenceable
NamingException
- If a naming exception was encountered while
retrieving the reference.public int[] getOpenedConnections(int usedTimeSec)
public void forceCloseConnection(int connectionId)
public int[] getOpenedConnections()
public Map getConnectionDetails(int connectionId)
public void connectionClosed(ConnectionEvent event)
connectionClosed
in interface ConnectionEventListener
public void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred
in interface ConnectionEventListener
public int getCurrentOpened()
getCurrentOpened
in interface Pool
public int getCurrentBusy()
getCurrentBusy
in interface Pool
public void recomputeBusy()
public int getCurrentInTx()
getCurrentInTx
in interface Pool
public 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 Pool
testStatement
- 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 |