Package org.apache.commons.dbcp
Class PoolableConnection
- java.lang.Object
-
- org.apache.commons.dbcp.AbandonedTrace
-
- org.apache.commons.dbcp.DelegatingConnection
-
- org.apache.commons.dbcp.PoolableConnection
-
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
- Direct Known Subclasses:
PoolableManagedConnection
public class PoolableConnection extends DelegatingConnection
A delegating connection that, rather than closing the underlying connection, returns itself to anObjectPool
when closed.- Version:
- $Revision: 758745 $ $Date: 2009-03-26 13:02:20 -0400 (Thu, 26 Mar 2009) $
- Author:
- Rodney Waldhoff, Glenn L. Nielsen, James House
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.pool.ObjectPool
_pool
The pool to which I should return.-
Fields inherited from class org.apache.commons.dbcp.DelegatingConnection
_closed, _conn
-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Constructor Description PoolableConnection(Connection conn, org.apache.commons.pool.ObjectPool pool)
PoolableConnection(Connection conn, org.apache.commons.pool.ObjectPool pool, AbandonedConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Returns me to my pool.void
reallyClose()
Actually close my underlyingConnection
.-
Methods inherited from class org.apache.commons.dbcp.DelegatingConnection
abort, activate, checkOpen, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, equals, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getDelegate, getDelegateInternal, getHoldability, getInnermostDelegate, getInnermostDelegateInternal, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, handleException, hashCode, innermostDelegateEquals, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, passivate, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setDelegate, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrap
-
Methods inherited from class org.apache.commons.dbcp.AbandonedTrace
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
-
-
-
Constructor Detail
-
PoolableConnection
public PoolableConnection(Connection conn, org.apache.commons.pool.ObjectPool pool)
- Parameters:
conn
- my underlying connectionpool
- the pool to which I should return when closed
-
PoolableConnection
public PoolableConnection(Connection conn, org.apache.commons.pool.ObjectPool pool, AbandonedConfig config)
- Parameters:
conn
- my underlying connectionpool
- the pool to which I should return when closedconfig
- the abandoned configuration settings
-
-
Method Detail
-
close
public void close() throws SQLException
Returns me to my pool.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classDelegatingConnection
- Throws:
SQLException
-
reallyClose
public void reallyClose() throws SQLException
Actually close my underlyingConnection
.- Throws:
SQLException
-
-