|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.jonas.dbm.ConnectionManager
DataSource implementation. Manage a pool of connections.
Constructor Summary | |
ConnectionManager()
Constructor for Factory |
|
ConnectionManager(boolean isClient)
Always called with true |
Method Summary | |
void |
adjust()
Adjust the pool size, according to poolMax and poolMin values. |
java.lang.String |
checkConnection(java.lang.String testStatement)
Check on a connection the test statement |
void |
closeAllConnection()
Close all connections in the pool, when server is shut down. |
void |
connectionClosed(javax.sql.ConnectionEvent event)
|
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
|
void |
freeConnections(javax.transaction.Transaction tx)
The transaction has committed (or rolled back). |
int |
getBusyMaxRecent()
|
int |
getBusyMinRecent()
|
int |
getCheckLevel()
|
java.lang.String |
getClassName()
|
java.sql.Connection |
getConnection()
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Attempts to establish a connection with the data source that this DataSource object represents. |
int |
getConnectionFailures()
|
int |
getConnectionLeaks()
|
static ConnectionManager |
getConnectionManager(java.lang.String dsname)
get the ConnectionManager matching the DataSource name |
int |
getCurrentBusy()
|
int |
getCurrentInTx()
|
int |
getCurrentOpened()
|
int |
getCurrentWaiters()
|
java.lang.String |
getDataSourceDescription()
|
java.lang.String |
getDatasourceName()
|
java.lang.String |
getDSName()
|
int |
getLoginTimeout()
|
java.io.PrintWriter |
getLogWriter()
|
java.lang.String |
getMapperName()
|
int |
getMaxAge()
|
long |
getMaxAgeMilli()
|
int |
getMaxOpenTime()
|
long |
getMaxOpenTimeMilli()
|
int |
getMaxWaiters()
|
int |
getMaxWaitTime()
|
int |
getOpenedCount()
|
java.lang.String |
getPassword()
|
Pool |
getPool()
|
int |
getPoolMax()
|
int |
getPoolMin()
|
int |
getPstmtMax()
|
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
int |
getRejectedFull()
|
int |
getRejectedOpen()
|
int |
getRejectedOther()
|
int |
getRejectedTimeout()
|
int |
getSamplingPeriod()
|
int |
getServedOpen()
|
java.lang.String |
getTestStatement()
|
java.lang.String |
getTransactionIsolation()
|
java.lang.String |
getUrl()
|
java.lang.String |
getUserName()
|
int |
getWaiterCount()
|
int |
getWaitersHigh()
|
int |
getWaitersHighRecent()
|
long |
getWaitingHigh()
|
long |
getWaitingHighRecent()
|
long |
getWaitingTime()
|
javax.sql.XAConnection |
getXAConnection()
|
javax.sql.XAConnection |
getXAConnection(java.lang.String user,
java.lang.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(java.lang.String user,
javax.transaction.Transaction tx)
lookup connection in the pool for this user/tx |
void |
poolConfigure(java.lang.String connchecklevel,
java.lang.String connmaxage,
java.lang.String maxopentime,
java.lang.String connteststmt,
java.lang.String pstmtmax,
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 |
recomputeBusy()
compute current min/max busyConnections |
void |
sampling()
make samples with some monitoring values |
void |
setCheckLevel(int level)
|
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)
|
void |
setLogWriter(java.io.PrintWriter out)
|
void |
setMapperName(java.lang.String mappername)
|
void |
setMaxAge(int mn)
|
void |
setMaxOpenTime(int mn)
|
void |
setMaxWaiters(int nb)
|
void |
setMaxWaitTime(int sec)
|
void |
setPassword(java.lang.String s)
|
void |
setPoolMax(int max)
|
void |
setPoolMin(int min)
|
void |
setPstmtMax(int nb)
|
void |
setSamplingPeriod(int sec)
|
void |
setTestStatement(java.lang.String s)
|
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
Method Detail |
public boolean isClientCase()
public Pool getPool()
public static ConnectionManager getConnectionManager(java.lang.String dsname)
public java.lang.String getDSName()
public void setDSName(java.lang.String s)
s
- Jndi name for the datasourcepublic java.lang.String getDatasourceName()
public void setDatasourceName(java.lang.String s)
public 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 java.lang.String getDataSourceDescription()
public void setDataSourceDescription(java.lang.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 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 java.lang.String getTestStatement()
getTestStatement
in interface Pool
public void setTestStatement(java.lang.String s)
setTestStatement
in interface Pool
s
- test statementpublic void poolConfigure(java.lang.String connchecklevel, java.lang.String connmaxage, java.lang.String maxopentime, java.lang.String connteststmt, java.lang.String pstmtmax, 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 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.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 java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
setLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
username
- - the database user on whose behalf the connection is being madepassword
- - the user's password
java.sql.SQLException
- - if a database access error occurspublic javax.sql.XAConnection getXAConnection() throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
java.sql.SQLException
public javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String passwd) throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
user
- - the database user on whose behalf the connection is being madepasswd
- - the user's password
java.sql.SQLException
- - if a database access error occurspublic 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 void connectionClosed(javax.sql.ConnectionEvent event)
connectionClosed
in interface javax.sql.ConnectionEventListener
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred
in interface javax.sql.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(java.lang.String user, javax.transaction.Transaction tx) throws java.sql.SQLException
user
- user nametx
- Transaction the connection is involved
java.sql.SQLException
- Cannot open a connection because the pool's max size is reachedpublic void freeConnections(javax.transaction.Transaction tx)
tx
- the non null transactionpublic void closeAllConnection()
public java.lang.String checkConnection(java.lang.String testStatement) throws java.sql.SQLException
checkConnection
in interface Pool
testStatement
- the statement to use for test
java.sql.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 |