|
||||||
| 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
public class PoolingConnection
A DelegatingConnection that pools PreparedStatements.
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(java.sql.Connection c)
Constructor. |
|
PoolingConnection(java.sql.Connection c,
org.apache.commons.pool.KeyedObjectPool pool)
Constructor. |
|
| Method Summary | |
|---|---|
void |
activateObject(java.lang.Object key,
java.lang.Object obj)
My KeyedPoolableObjectFactory method for activating
PreparedStatements. |
void |
close()
Close and free all PreparedStatements from my pool, and
close my underlying connection. |
void |
destroyObject(java.lang.Object key,
java.lang.Object obj)
My KeyedPoolableObjectFactory method for destroying
PreparedStatements. |
java.lang.Object |
makeObject(java.lang.Object obj)
My KeyedPoolableObjectFactory method for creating
PreparedStatements. |
void |
passivateObject(java.lang.Object key,
java.lang.Object obj)
My KeyedPoolableObjectFactory method for passivating
PreparedStatements. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Create or obtain a PreparedStatement from my pool. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Create or obtain a PreparedStatement from my pool. |
java.lang.String |
toString()
|
boolean |
validateObject(java.lang.Object key,
java.lang.Object obj)
My KeyedPoolableObjectFactory method for validating
PreparedStatements. |
| 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, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Constructor Detail |
|---|
public PoolingConnection(java.sql.Connection c)
c - the underlying Connection.
public PoolingConnection(java.sql.Connection c,
org.apache.commons.pool.KeyedObjectPool pool)
c - the underlying Connection.maxSleepingPerKey - the maximum number of PreparedStatements that may sit idle in my pool (per type)| Method Detail |
|---|
public void activateObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for activating
PreparedStatements. (Currently a no-op.)
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - ignored
java.lang.Exception
public void close()
throws java.sql.SQLException
PreparedStatements from my pool, and
close my underlying connection.
close in interface java.sql.Connectionclose in class DelegatingConnectionjava.sql.SQLException
public void destroyObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for destroying
PreparedStatements.
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - the PreparedStatement to be destroyed.
java.lang.Exception
public java.lang.Object makeObject(java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for creating
PreparedStatements.
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactoryobj - the key for the PreparedStatement to be created
java.lang.Exception
public void passivateObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for passivating
PreparedStatements. Currently invokes PreparedStatement.clearParameters().
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - a PreparedStatement
java.lang.Exception
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
PreparedStatement from my pool.
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionPoolablePreparedStatement
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
PreparedStatement from my pool.
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionPoolablePreparedStatement
java.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Object
public boolean validateObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for validating
PreparedStatements.
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - ignored
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||