| |
|
| java.lang.Object org.ow2.easybeans.component.jdbcpool.ConnectionManager
Method Summary | |
public synchronized void | adjust() Adjust the pool size, according to poolMax and poolMin values. | public String | checkConnection(String testStatement) Check on a connection the test statement. | public synchronized void | closeAllConnection() Close all connections in the pool, when server is shut down. | public void | connectionClosed(ConnectionEvent event) Notifies this ConnectionEventListener that
the application has called the method close on its
representation of a pooled connection. | public void | connectionErrorOccurred(ConnectionEvent event) Notifies this ConnectionEventListener that
a fatal error has occurred and the pooled connection can
no longer be used. | 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) Gets the ConnectionManager matching the DataSource name.
Parameters: dsname - datasource name. | public int | getCurrentBusy() | public int | getCurrentInTx() | public int | getCurrentOpened() | public int | getCurrentWaiters() | public String | getDSName() | public String | getDatasourceName() Gets the name of the datasource. | public PrintWriter | getLogWriter() | public int | getLoginTimeout() | 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 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() Gets the transaction isolation level. | 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() Attempts to establish a physical database connection that can be
used in a distributed transaction. | public XAConnection | getXAConnection(String user, String passwd) Attempts to establish a physical database connection, using the given
user name and password. | public synchronized JManagedConnection | openConnection(String user, Transaction tx) Lookup connection in the pool for this user/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() compute current min/max busyConnections. | public synchronized void | sampling() make samples with some monitoring values. | public void | setCheckLevel(int level) | public void | setClassName(String className) Sets the driver class for JDBC. | public void | setDSName(String s) | public void | setDatasourceName(String dataSourceName) Sets the name of the datasource. | public void | setLogWriter(PrintWriter out) | public void | setLoginTimeout(int seconds) | public void | setMaxAge(int mn) | public void | setMaxOpenTime(int mn) | public void | setMaxWaitTime(int sec) | public void | setMaxWaiters(int nb) | public void | setPassword(String password) Sets the password used to get connections. | 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) | protected void | setTm(TransactionManager tm) Sets the transaction managed used by the connections. | public void | setTransactionIsolation(String level) Sets the transaction isolation level of the connections. | public void | setUrl(String url) Sets the url to get connections. | public void | setUserName(String userName) Sets the user for getting connections. |
ConnectionManager | public ConnectionManager()(Code) | | Constructor for Factory.
|
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 messageotherwise throws: SQLException - If an error occured when trying to test (not due tothe 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.
|
connectionClosed | public void connectionClosed(ConnectionEvent event)(Code) | | Notifies this ConnectionEventListener that
the application has called the method close on its
representation of a pooled connection.
Parameters: event - an event object describing the source ofthe event |
connectionErrorOccurred | public void connectionErrorOccurred(ConnectionEvent event)(Code) | | Notifies this ConnectionEventListener that
a fatal error has occurred and the pooled connection can
no longer be used. The driver makes this notification just
before it throws the application the SQLException
contained in the given ConnectionEvent object.
Parameters: event - an event object describing the source ofthe event and containing the SQLException that thedriver is about to throw |
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 |
getClassName | public String getClassName()(Code) | | the JDBC driver class name. |
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 isbeing 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) | | Gets the ConnectionManager matching the DataSource name.
Parameters: dsname - datasource name. a connection manager impl. |
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 |
getDatasourceName | public String getDatasourceName()(Code) | | Gets the name of the datasource.
the name of the 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. |
getPassword | public String getPassword()(Code) | | the password used for connections. |
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 waiteroverflow. |
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) | | Gets the transaction isolation level.
transaction isolation level. |
getUrl | public String getUrl()(Code) | | the url used to get the connection. |
getUserName | public String getUserName()(Code) | | the user used for getting connections. |
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() throws SQLException(Code) | | Attempts to establish a physical database connection that can be
used in a distributed transaction.
an XAConnection object, which represents aphysical connection to a data source, that can be used ina distributed transaction exception: SQLException - if a database access error occurs |
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 beingmade Parameters: passwd - - the user's password an XAConnection object, which represents a physical connection toa data source, that can be used in a distributed transaction throws: SQLException - - if a database access error occurs |
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 sizeis 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 |
setDatasourceName | public void setDatasourceName(String dataSourceName)(Code) | | Sets the name of the datasource.
Parameters: dataSourceName - the name of the datasource |
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 |
setPassword | public void setPassword(String password)(Code) | | Sets the password used to get connections.
Parameters: password - the password value. |
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 |
setTm | protected void setTm(TransactionManager tm)(Code) | | Sets the transaction managed used by the connections.
Parameters: tm - the transaction manager. |
setTransactionIsolation | public void setTransactionIsolation(String level)(Code) | | Sets the transaction isolation level of the connections.
Parameters: level - the level of isolation. |
setUrl | public void setUrl(String url)(Code) | | Sets the url to get connections.
Parameters: url - the url for JDBC connections. |
setUserName | public void setUserName(String userName)(Code) | | Sets the user for getting connections.
Parameters: userName - the name of the user. |
|
|
|