|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.dbcp.AbandonedTrace
org.apache.commons.dbcp.DelegatingConnection
org.apache.commons.dbcp.PoolingConnection
A DelegatingConnection
that pools PreparedStatement
s.
My prepareStatement(java.lang.String)
methods, rather than creating a new PreparedStatement
each time, may actually pull the PreparedStatement
from a pool of unused statements.
The Statement.close()
method of the returned PreparedStatement
doesn't
actually close the statement, but rather returns it to my pool. (See PoolablePreparedStatement
.)
PoolablePreparedStatement
Field Summary |
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
PoolingConnection(Connection c)
Constructor. |
|
PoolingConnection(Connection c,
KeyedObjectPool pool)
Constructor. |
Method Summary | |
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. |
Methods inherited from class org.apache.commons.dbcp.DelegatingConnection |
clearWarnings, commit, createStatement, createStatement, createStatement, equals, getAutoCommit, getCatalog, getDelegate, getHoldability, getInnermostDelegate, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, hashCode, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setDelegate, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
Methods inherited from class org.apache.commons.dbcp.AbandonedTrace |
printStackTrace |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.sql.Connection |
clearWarnings, commit, createStatement, createStatement, createStatement, getAutoCommit, getCatalog, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
Constructor Detail |
public PoolingConnection(Connection c)
c
- the underlying Connection
.public PoolingConnection(Connection c, KeyedObjectPool pool)
c
- the underlying Connection
.Method Detail |
public void activateObject(Object key, Object obj) throws Exception
KeyedPoolableObjectFactory
method for activating
PreparedStatement
s. (Currently a no-op.)
key
- ignoredobj
- ignored
Exception
public void close() throws SQLException
PreparedStatement
s from my pool, and
close my underlying connection.
close
in interface Connection
close
in class DelegatingConnection
SQLException
public void destroyObject(Object key, Object obj) throws Exception
KeyedPoolableObjectFactory
method for destroying
PreparedStatement
s.
key
- ignoredobj
- the PreparedStatement
to be destroyed.
Exception
public Object makeObject(Object obj) throws Exception
KeyedPoolableObjectFactory
method for creating
PreparedStatement
s.
obj
- the key for the PreparedStatement
to be created
Exception
public void passivateObject(Object key, Object obj) throws Exception
KeyedPoolableObjectFactory
method for passivating
PreparedStatement
s. Currently invokes PreparedStatement.clearParameters()
.
key
- ignoredobj
- a PreparedStatement
Exception
public PreparedStatement prepareStatement(String sql) throws SQLException
PreparedStatement
from my pool.
prepareStatement
in interface Connection
prepareStatement
in class DelegatingConnection
PoolablePreparedStatement
SQLException
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
PreparedStatement
from my pool.
prepareStatement
in interface Connection
prepareStatement
in class DelegatingConnection
PoolablePreparedStatement
SQLException
public String toString()
public boolean validateObject(Object key, Object obj)
KeyedPoolableObjectFactory
method for validating
PreparedStatement
s.
key
- ignoredobj
- ignored
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |