| java.lang.Object org.objectweb.jonas.dbm.ConnectionManager
Inner Class :class PoolMonitor extends Thread | |
Method Summary | |
public synchronized void | adjust() Adjust the pool size, according to poolMax and poolMin values. | public String | checkConnection(String testStatement) | public synchronized void | closeAllConnection() Close all connections in the pool, when server is shut down. | public void | connectionClosed(ConnectionEvent event) | public void | connectionErrorOccurred(ConnectionEvent event) | public synchronized void | freeConnections(Transaction tx) The transaction has committed (or rolled back). | public int | getBusyMaxRecent() | public int | getBusyMinRecent() | public int | getCheckLevel() | public String | getClassName() | public Connection | getConnection() | public Connection | getConnection(String username, String password) Attempts to establish a connection with the data source that this DataSource object represents. | public int | getConnectionFailures() | public int | getConnectionLeaks() | public static ConnectionManager | getConnectionManager(String dsname) | public int | getCurrentBusy() | public int | getCurrentInTx() | public int | getCurrentOpened() | public int | getCurrentWaiters() | public String | getDSName() | public String | getDataSourceDescription() | public String | getDatasourceName() | public PrintWriter | getLogWriter() | public int | getLoginTimeout() | public String | getMapperName() | public int | getMaxAge() | public long | getMaxAgeMilli() | public int | getMaxOpenTime() | public long | getMaxOpenTimeMilli() | public int | getMaxWaitTime() | public int | getMaxWaiters() | public int | getOpenedCount() | public String | getPassword() | public Pool | getPool() | public int | getPoolMax() | public int | getPoolMin() | public int | getPstmtMax() | public Reference | getReference() Retrieves the Reference of this object. | public int | getRejectedFull() | public int | getRejectedOpen() | public int | getRejectedOther() | public int | getRejectedTimeout() | public int | getSamplingPeriod() | public int | getServedOpen() | public String | getTestStatement() | public String | getTransactionIsolation() | public String | getUrl() | public String | getUserName() | public int | getWaiterCount() | public int | getWaitersHigh() | public int | getWaitersHighRecent() | public long | getWaitingHigh() | public long | getWaitingHighRecent() | public long | getWaitingTime() | public XAConnection | getXAConnection() | public XAConnection | getXAConnection(String user, String passwd) Attempts to establish a physical database connection, using the given user name and password. | public boolean | isClientCase() This manager is in the client case or not ?
boolean true if this is the client caseTODO : must be removed. | public synchronized JManagedConnection | openConnection(String user, Transaction tx) | public void | poolConfigure(String connchecklevel, String connmaxage, String maxopentime, String connteststmt, String pstmtmax, String minconpool, String maxconpool, String maxwaittime, String maxwaiters, String samplingperiod) Configure the Connection pool. | public void | recomputeBusy() | public synchronized void | sampling() | public void | setCheckLevel(int level) | public void | setClassName(String s) | public void | setDSName(String s) | public void | setDataSourceDescription(String dsDesc) | public void | setDatasourceName(String s) | public void | setLogWriter(PrintWriter out) | public void | setLoginTimeout(int seconds) | public void | setMapperName(String mappername) | public void | setMaxAge(int mn) | public void | setMaxOpenTime(int mn) | public void | setMaxWaitTime(int sec) | public void | setMaxWaiters(int nb) | public void | setPassword(String s) | public synchronized void | setPoolMax(int max) Parameters: max - max pool size. | public synchronized void | setPoolMin(int min) | public void | setPstmtMax(int nb) | public void | setSamplingPeriod(int sec) | public void | setTestStatement(String s) | public void | setTransactionIsolation(String level) | public void | setUrl(String s) | public void | setUserName(String s) |
ConnectionManager | public ConnectionManager() throws Exception(Code) | | Constructor for Factory
|
ConnectionManager | public ConnectionManager(boolean isClient) throws Exception(Code) | | Always called with true
|
adjust | public synchronized void adjust()(Code) | | Adjust the pool size, according to poolMax and poolMin values.
Also remove old connections in the freeList.
|
checkConnection | public String checkConnection(String testStatement) throws SQLException(Code) | | Check on a connection the test statement
Parameters: testStatement - the statement to use for test the test statement if the test succeeded, an error message otherwise throws: SQLException - If an error occured when trying to test (not due to the test itself,but to other preliminary or post operation). |
closeAllConnection | public synchronized void closeAllConnection()(Code) | | Close all connections in the pool, when server is shut down.
|
freeConnections | public synchronized void freeConnections(Transaction tx)(Code) | | The transaction has committed (or rolled back). We can return its
connections to the pool of available connections.
Parameters: tx - the non null transaction |
getBusyMaxRecent | public int getBusyMaxRecent()(Code) | | maximum nb of busy connections in last sampling period |
getBusyMinRecent | public int getBusyMinRecent()(Code) | | minimum nb of busy connections in last sampling period |
getCheckLevel | public int getCheckLevel()(Code) | | connection checking level |
getConnection | public Connection getConnection(String username, String password) throws SQLException(Code) | | Attempts to establish a connection with the data source that this DataSource object represents.
- comes from the javax.sql.DataSource interface
Parameters: username - - the database user on whose behalf the connection is being made Parameters: password - - the user's password a connection to the data source throws: SQLException - - if a database access error occurs |
getConnectionFailures | public int getConnectionFailures()(Code) | | int number of xa connection failures on open |
getConnectionLeaks | public int getConnectionLeaks()(Code) | | int number of connection leaks |
getConnectionManager | public static ConnectionManager getConnectionManager(String dsname)(Code) | | get the ConnectionManager matching the DataSource name
|
getCurrentBusy | public int getCurrentBusy()(Code) | | int number of busy xa connection |
getCurrentInTx | public int getCurrentInTx()(Code) | | int number of xa connection reserved for tx |
getCurrentOpened | public int getCurrentOpened()(Code) | | int number of xa connection |
getCurrentWaiters | public int getCurrentWaiters()(Code) | | current number of connection waiters |
getDSName | public String getDSName()(Code) | | Jndi name of the datasource |
getDataSourceDescription | public String getDataSourceDescription()(Code) | | the desrciption of this datasource |
getMaxAge | public int getMaxAge()(Code) | | max age for connections (in mm) |
getMaxAgeMilli | public long getMaxAgeMilli()(Code) | | max age for connections (in millisec) |
getMaxOpenTime | public int getMaxOpenTime()(Code) | | max age for connections (in mns) |
getMaxOpenTimeMilli | public long getMaxOpenTimeMilli()(Code) | | max age for connections (in millisecs) |
getMaxWaitTime | public int getMaxWaitTime()(Code) | | waiter timeout in seconds |
getMaxWaiters | public int getMaxWaiters()(Code) | | max nb of waiters |
getOpenedCount | public int getOpenedCount()(Code) | | int number of physical jdbc connection opened |
getPool | public Pool getPool()(Code) | | The pool associated to this datasource |
getPoolMax | public int getPoolMax()(Code) | | actual max pool size |
getPoolMin | public int getPoolMin()(Code) | | min pool size |
getPstmtMax | public int getPstmtMax()(Code) | | PreparedStatement cache size |
getReference | public Reference getReference() throws NamingException(Code) | | Retrieves the Reference of this object. Used at binding time by JNDI
to build a reference on this object.
The non-null Reference of this object. exception: NamingException - If a naming exception was encountered whileretrieving the reference. |
getRejectedFull | public int getRejectedFull()(Code) | | int number of open calls that were rejected due to waiter overflow |
getRejectedOpen | public int getRejectedOpen()(Code) | | int number of open calls that were rejected |
getRejectedOther | public int getRejectedOther()(Code) | | int number of open calls that were rejected |
getRejectedTimeout | public int getRejectedTimeout()(Code) | | int number of open calls that were rejected by timeout |
getSamplingPeriod | public int getSamplingPeriod()(Code) | | sampling period in sec. |
getServedOpen | public int getServedOpen()(Code) | | int number of xa connection served |
getTestStatement | public String getTestStatement()(Code) | | test statement used when checkLevel = 2. |
getTransactionIsolation | public String getTransactionIsolation()(Code) | | |
getWaiterCount | public int getWaiterCount()(Code) | | total nb of waiters since the datasource creation |
getWaitersHigh | public int getWaitersHigh()(Code) | | maximum nb of waiters since the datasource creation |
getWaitersHighRecent | public int getWaitersHighRecent()(Code) | | maximum nb of waiters in last sampling period |
getWaitingHigh | public long getWaitingHigh()(Code) | | max waiting time since the datasource creation |
getWaitingHighRecent | public long getWaitingHighRecent()(Code) | | max waiting time in last sampling period |
getWaitingTime | public long getWaitingTime()(Code) | | total waiting time since the datasource creation |
getXAConnection | public XAConnection getXAConnection(String user, String passwd) throws SQLException(Code) | | Attempts to establish a physical database connection, using the given user name and password.
The connection that is returned is one that can be used in a distributed transaction
- comes from the javax.sql.XADataSource interface
Parameters: user - - the database user on whose behalf the connection is being made Parameters: passwd - - the user's password an XAConnection object, which represents a physical connection to a data source,that can be used in a distributed transaction throws: SQLException - - if a database access error occurs |
isClientCase | public boolean isClientCase()(Code) | | This manager is in the client case or not ?
boolean true if this is the client caseTODO : must be removed. A client can lookup a datasource |
openConnection | public synchronized JManagedConnection openConnection(String user, Transaction tx) throws SQLException(Code) | | lookup connection in the pool for this user/tx
Parameters: user - user name Parameters: tx - Transaction the connection is involved a free JManagedConnection (never null) throws: SQLException - Cannot open a connection because the pool's max size is reached |
poolConfigure | public void poolConfigure(String connchecklevel, String connmaxage, String maxopentime, String connteststmt, String pstmtmax, String minconpool, String maxconpool, String maxwaittime, String maxwaiters, String samplingperiod)(Code) | | Configure the Connection pool. Called by the Container at init.
Configuration can be set in datasource.properties files.
Parameters: connchecklevel - JDBC connection checking level Parameters: connmaxage - JDBC connection maximum age Parameters: maxopentime - JDBC connection maximum open time Parameters: connteststmt - SQL query for test statement Parameters: pstmtmax - prepare statement pool size per managed connection Parameters: minconpool - Min size for the connection pool Parameters: maxconpool - Max size for the connection pool Parameters: maxwaittime - Max time to wait for a connection (in seconds) Parameters: maxwaiters - Max nb of waiters for a connection Parameters: samplingperiod - sampling period in sec. |
recomputeBusy | public void recomputeBusy()(Code) | | compute current min/max busyConnections
|
sampling | public synchronized void sampling()(Code) | | make samples with some monitoring values
|
setCheckLevel | public void setCheckLevel(int level)(Code) | | Parameters: level - jdbc connection checking level (0, 1, or 2) |
setDSName | public void setDSName(String s)(Code) | | Parameters: s - Jndi name for the datasource |
setDataSourceDescription | public void setDataSourceDescription(String dsDesc)(Code) | | Parameters: dsDesc - the desrciption of this datasource |
setDatasourceName | public void setDatasourceName(String s)(Code) | | |
setMapperName | public void setMapperName(String mappername)(Code) | | |
setMaxAge | public void setMaxAge(int mn)(Code) | | Parameters: mn - max age of connection in minutes |
setMaxOpenTime | public void setMaxOpenTime(int mn)(Code) | | Parameters: mn - max time of open connection in minutes |
setMaxWaitTime | public void setMaxWaitTime(int sec)(Code) | | Parameters: sec - max time to wait for a connection, in seconds |
setMaxWaiters | public void setMaxWaiters(int nb)(Code) | | Parameters: nb - max nb of waiters |
setPoolMax | public synchronized void setPoolMax(int max)(Code) | | Parameters: max - max pool size. -1 means "no limit". |
setPoolMin | public synchronized void setPoolMin(int min)(Code) | | Parameters: min - minimum connection pool size to be set. |
setPstmtMax | public void setPstmtMax(int nb)(Code) | | Parameters: nb - PreparedStatement cache size |
setSamplingPeriod | public void setSamplingPeriod(int sec)(Code) | | Parameters: sec - sampling period in sec. |
setTestStatement | public void setTestStatement(String s)(Code) | | Parameters: s - test statement |
setTransactionIsolation | public void setTransactionIsolation(String level)(Code) | | |
|
|