org.apache.commons.dbcp
public class DelegatingConnection extends AbandonedTrace implements Connection
All of the methods from the Connection interface simply check to see that the Connection is active, and call the corresponding method on the "delegate" provided in my constructor.
Extends AbandonedTrace to implement Connection tracking and logging of code which created the Connection. Tracking the Connection ensures that the AbandonedObjectPool can close this connection and recycle it if its pool of connections is nearing exhaustion and this connection's last usage is older than the removeAbandonedTimeout.
Version: $Revision: 1.19 $ $Date: 2004/03/06 13:35:31 $
Constructor Summary | |
---|---|
DelegatingConnection(Connection c)
Create a wrapper for the Connectin which traces this
Connection in the AbandonedObjectPool.
| |
DelegatingConnection(Connection c, AbandonedConfig config)
Create a wrapper for the Connection which traces
the Statements created so that any unclosed Statements
can be closed when this Connection is closed.
|
Method Summary | |
---|---|
void | clearWarnings() |
void | close()
Closes the underlying connection, and close
any Statements that were not explicitly closed. |
void | commit() |
Statement | createStatement() |
Statement | createStatement(int resultSetType, int resultSetConcurrency) |
Statement | createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) |
boolean | equals(Object obj) |
boolean | getAutoCommit() |
String | getCatalog() |
Connection | getDelegate()
Returns my underlying Connection. |
int | getHoldability() |
Connection | getInnermostDelegate()
If my underlying Connection is not a
DelegatingConnection, returns it,
otherwise recursively invokes this method on
my delegate.
|
DatabaseMetaData | getMetaData() |
int | getTransactionIsolation() |
Map | getTypeMap() |
SQLWarning | getWarnings() |
int | hashCode() |
boolean | isClosed() |
boolean | isReadOnly() |
String | nativeSQL(String sql) |
CallableStatement | prepareCall(String sql) |
CallableStatement | prepareCall(String sql, int resultSetType, int resultSetConcurrency) |
CallableStatement | prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) |
PreparedStatement | prepareStatement(String sql) |
PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency) |
PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) |
PreparedStatement | prepareStatement(String sql, int autoGeneratedKeys) |
PreparedStatement | prepareStatement(String sql, int[] columnIndexes) |
PreparedStatement | prepareStatement(String sql, String[] columnNames) |
void | releaseSavepoint(Savepoint savepoint) |
void | rollback() |
void | rollback(Savepoint savepoint) |
void | setAutoCommit(boolean autoCommit) |
void | setCatalog(String catalog) |
void | setDelegate(Connection c) Sets my delegate. |
void | setHoldability(int holdability) |
void | setReadOnly(boolean readOnly) |
Savepoint | setSavepoint() |
Savepoint | setSavepoint(String name) |
void | setTransactionIsolation(int level) |
void | setTypeMap(Map map) |
Parameters: c the Connection to delegate all calls to.
Deprecated: AbandonedConfig is now deprecated.
Create a wrapper for the Connection which traces the Statements created so that any unclosed Statements can be closed when this Connection is closed.Parameters: Connection the Connection to delegate all calls to. AbandonedConfig the configuration for tracing abandoned objects
Returns: my underlying Connection.
Hence this method will return the first delegate that is not a DelegatingConnection, or null when no non-DelegatingConnection delegate can be found by transversing this chain.
This method is useful when you may have nested DelegatingConnections, and you want to make sure to obtain a "genuine" Connection.