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:
java.lang.AutoCloseable
,java.sql.Connection
,java.sql.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
-
-
Constructor Summary
Constructors Constructor Description PoolableConnection(java.sql.Connection conn, org.apache.commons.pool.ObjectPool pool)
PoolableConnection(java.sql.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
-
-
-
-
Constructor Detail
-
PoolableConnection
public PoolableConnection(java.sql.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(java.sql.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 java.sql.SQLException
Returns me to my pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.sql.Connection
- Overrides:
close
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
reallyClose
public void reallyClose() throws java.sql.SQLException
Actually close my underlyingConnection
.- Throws:
java.sql.SQLException
-
-