PoolableConnectionMXBeanPoolableManagedConnectionpublic class PoolableConnection extends DelegatingConnection<java.sql.Connection> implements PoolableConnectionMXBean
ObjectPool when
closed.| Constructor | Description |
|---|---|
PoolableConnection(java.sql.Connection conn,
org.apache.commons.pool2.ObjectPool<PoolableConnection> pool,
javax.management.ObjectName jmxName) |
|
PoolableConnection(java.sql.Connection conn,
org.apache.commons.pool2.ObjectPool<PoolableConnection> pool,
javax.management.ObjectName jmxName,
java.util.Collection<java.lang.String> disconnectSqlCodes,
boolean fastFailValidation) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Returns me to my pool.
|
java.lang.String |
getToString() |
Expose the
DelegatingConnection.toString() method via a bean getter so it can be read
as a property via JMX. |
boolean |
isClosed() |
|
void |
reallyClose() |
Actually close my underlying
Connection. |
void |
validate(java.lang.String sql,
int timeout) |
Validates the connection, using the following algorithm:
If
fastFailValidation (constructor argument) is true and
this connection has previously thrown a fatal disconnection exception,
a SQLException is thrown. |
getLastUsedbeginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValidabort, clearCachedState, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCacheState, getCatalog, getClientInfo, getClientInfo, getDefaultQueryTimeout, getDelegate, getHoldability, getInnermostDelegate, getInnermostDelegateInternal, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, innermostDelegateEquals, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCacheState, setCatalog, setClientInfo, setClientInfo, setDefaultQueryTimeout, setDelegate, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrapequals, getClass, hashCode, notify, notifyAll, wait, wait, waitclearCachedState, clearWarnings, getAutoCommit, getCacheState, getCatalog, getHoldability, getSchema, getTransactionIsolation, isReadOnly, setAutoCommit, setCacheState, setCatalog, setHoldability, setReadOnly, setSchema, setTransactionIsolationpublic PoolableConnection(java.sql.Connection conn,
org.apache.commons.pool2.ObjectPool<PoolableConnection> pool,
javax.management.ObjectName jmxName)
conn - my underlying connectionpool - the pool to which I should return when closedjmxName - JMX namepublic PoolableConnection(java.sql.Connection conn,
org.apache.commons.pool2.ObjectPool<PoolableConnection> pool,
javax.management.ObjectName jmxName,
java.util.Collection<java.lang.String> disconnectSqlCodes,
boolean fastFailValidation)
conn - my underlying connectionpool - the pool to which I should return when closedjmxName - JMX namedisconnectSqlCodes - SQL_STATE codes considered fatal disconnection errorsfastFailValidation - true means fatal disconnection errors cause subsequent
validations to fail immediately (no attempt to run query or isValid)public void close()
throws java.sql.SQLException
close in interface PoolableConnectionMXBeanclose in class DelegatingConnection<java.sql.Connection>java.sql.SQLExceptionpublic java.lang.String getToString()
DelegatingConnection.toString() method via a bean getter so it can be read
as a property via JMX.getToString in interface PoolableConnectionMXBeanpublic boolean isClosed()
throws java.sql.SQLException
This method should not be used by a client to determine whether or not a
connection should be return to the connection pool (by calling
close()). Clients should always attempt to return a connection
to the pool once it is no longer required.
isClosed in interface PoolableConnectionMXBeanisClosed in class DelegatingConnection<java.sql.Connection>java.sql.SQLExceptionpublic void reallyClose()
throws java.sql.SQLException
Connection.reallyClose in interface PoolableConnectionMXBeanjava.sql.SQLExceptionpublic void validate(java.lang.String sql,
int timeout)
throws java.sql.SQLException
fastFailValidation (constructor argument) is true and
this connection has previously thrown a fatal disconnection exception,
a SQLException is thrown. sql is null, the driver's
#isValid(timeout) is called.
If it returns false, SQLException is thrown;
otherwise, this method returns successfully.sql is not null, it is executed as a query and if the resulting
ResultSet contains at least one row, this method returns
successfully. If not, SQLException is thrown.sql - validation querytimeout - validation timeoutjava.sql.SQLException - if validation fails or an SQLException occurs during validationCopyright © 2001-2015 Apache Software Foundation. Documenation generated March 25 2019.