org.apache.commons.dbcp
public class PoolingConnection extends DelegatingConnection implements Connection, KeyedPoolableObjectFactory
My {@link #prepareStatement} methods, rather than creating a new {@link PreparedStatement} each time, may actually pull the {@link PreparedStatement} from a pool of unused statements. The {@link PreparedStatement#close} method of the returned {@link PreparedStatement} doesn't actually close the statement, but rather returns it to my pool. (See {@link PoolablePreparedStatement}.)
Version: $Revision: 1.14 $ $Date: 2004/03/07 15:26:38 $
See Also: PoolablePreparedStatement
Constructor Summary | |
---|---|
PoolingConnection(Connection c)
Constructor. | |
PoolingConnection(Connection c, KeyedObjectPool pool)
Constructor. |
Method Summary | |
---|---|
void | activateObject(Object key, Object obj)
My {@link KeyedPoolableObjectFactory} method for activating
{@link PreparedStatement}s. |
void | close()
Close and free all {@link PreparedStatement}s from my pool, and
close my underlying connection. |
void | destroyObject(Object key, Object obj)
My {@link KeyedPoolableObjectFactory} method for destroying
{@link PreparedStatement}s. |
Object | makeObject(Object obj)
My {@link KeyedPoolableObjectFactory} method for creating
{@link PreparedStatement}s. |
void | passivateObject(Object key, Object obj)
My {@link KeyedPoolableObjectFactory} method for passivating
{@link PreparedStatement}s. |
PreparedStatement | prepareStatement(String sql)
Create or obtain a {@link PreparedStatement} from my pool. |
PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
Create or obtain a {@link PreparedStatement} from my pool. |
String | toString() |
boolean | validateObject(Object key, Object obj)
My {@link KeyedPoolableObjectFactory} method for validating
{@link PreparedStatement}s. |
Parameters: c the underlying {@link Connection}.
Parameters: c the underlying {@link Connection}. maxSleepingPerKey the maximum number of {@link PreparedStatement}s that may sit idle in my pool (per type)
Parameters: key ignored obj ignored
Parameters: key ignored obj the {@link PreparedStatement} to be destroyed.
Parameters: obj the key for the {@link PreparedStatement} to be created
Parameters: key ignored obj a {@link PreparedStatement}
Returns: a {@link PoolablePreparedStatement}
Returns: a {@link PoolablePreparedStatement}
Parameters: key ignored obj ignored
Returns: true