org.apache.commons.dbcp
Class PoolingConnection
- Connection, KeyedPoolableObjectFactory
public class PoolingConnection
implements Connection, KeyedPoolableObjectFactory
A
DelegatingConnection
that pools
PreparedStatement
s.
My
prepareStatement
methods, rather than creating a new
PreparedStatement
each time, may actually pull the
PreparedStatement
from a pool of unused statements.
The
PreparedStatement.close
method of the returned
PreparedStatement
doesn't
actually close the statement, but rather returns it to my pool. (See
PoolablePreparedStatement
.)
$Revision: 498524 $ $Date: 2007-01-21 21:44:45 -0700 (Sun, 21 Jan 2007) $- Rodney Waldhoff
- Dirk Verbeeck
void | activateObject(Object key, Object obj) - My
KeyedPoolableObjectFactory method for activating
PreparedStatement s.
|
void | close() - Close and free all
PreparedStatement s from my pool, and
close my underlying connection.
|
void | destroyObject(Object key, Object obj) - My
KeyedPoolableObjectFactory method for destroying
PreparedStatement s.
|
Object | makeObject(Object obj) - My
KeyedPoolableObjectFactory method for creating
PreparedStatement s.
|
void | passivateObject(Object key, Object obj) - My
KeyedPoolableObjectFactory method for passivating
PreparedStatement s.
|
PreparedStatement | prepareStatement(String sql) - Create or obtain a
PreparedStatement from my pool.
|
PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency) - Create or obtain a
PreparedStatement from my pool.
|
String | toString()
|
boolean | validateObject(Object key, Object obj) - My
KeyedPoolableObjectFactory method for validating
PreparedStatement s.
|
clearWarnings , close , commit , createStatement , createStatement , createStatement , equals , getAutoCommit , getCatalog , getDelegate , getHoldability , getInnermostDelegate , getMetaData , getTransactionIsolation , getTypeMap , getWarnings , hashCode , innermostDelegateEquals , isClosed , isReadOnly , nativeSQL , prepareCall , prepareCall , prepareCall , prepareStatement , prepareStatement , prepareStatement , prepareStatement , prepareStatement , prepareStatement , releaseSavepoint , rollback , rollback , setAutoCommit , setCatalog , setDelegate , setHoldability , setReadOnly , setSavepoint , setSavepoint , setTransactionIsolation , setTypeMap , toString |
PoolingConnection
public PoolingConnection(Connection c)
Constructor.
c
- the underlying Connection
.
PoolingConnection
public PoolingConnection(Connection c,
KeyedObjectPool pool)
Constructor.
c
- the underlying Connection
.pool
- KeyedObjectPool
of PreparedStatement
s
activateObject
public void activateObject(Object key,
Object obj)
throws Exception
My KeyedPoolableObjectFactory
method for activating
PreparedStatement
s. (Currently a no-op.)
key
- ignoredobj
- ignored
close
public void close()
throws SQLException
Close and free all PreparedStatement
s from my pool, and
close my underlying connection.
- close in interface DelegatingConnection
destroyObject
public void destroyObject(Object key,
Object obj)
throws Exception
My KeyedPoolableObjectFactory
method for destroying
PreparedStatement
s.
key
- ignoredobj
- the PreparedStatement
to be destroyed.
makeObject
public Object makeObject(Object obj)
throws Exception
My KeyedPoolableObjectFactory
method for creating
PreparedStatement
s.
obj
- the key for the PreparedStatement
to be created
passivateObject
public void passivateObject(Object key,
Object obj)
throws Exception
My KeyedPoolableObjectFactory
method for passivating
PreparedStatement
s. Currently invokes PreparedStatement.clearParameters
.
key
- ignoredobj
- a PreparedStatement
prepareStatement
public PreparedStatement prepareStatement(String sql)
throws SQLException
Create or obtain a PreparedStatement
from my pool.
- prepareStatement in interface DelegatingConnection
prepareStatement
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
Create or obtain a PreparedStatement
from my pool.
- prepareStatement in interface DelegatingConnection
validateObject
public boolean validateObject(Object key,
Object obj)
My KeyedPoolableObjectFactory
method for validating
PreparedStatement
s.
key
- ignoredobj
- ignored
Copyright © 2001-2004 Apache Software Foundation. Documenation generated June 19 2007.