Save This Page
Home » commons-dbcp-1.2.2-src » org.apache.commons » dbcp » [javadoc | source]
org.apache.commons.dbcp
public class: DelegatingConnection [javadoc | source]
java.lang.Object
   org.apache.commons.dbcp.AbandonedTrace
      org.apache.commons.dbcp.DelegatingConnection

All Implemented Interfaces:
    Connection

Direct Known Subclasses:
    PoolGuardConnectionWrapper, PoolGuardConnectionWrapper, PoolingConnection, PoolableConnection

A base delegating implementation of 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.

Field Summary
protected  Connection _conn    My delegate Connection
protected  boolean _closed     
Constructor:
 public DelegatingConnection(Connection c) 
    Create a wrapper for the Connectin which traces this Connection in the AbandonedObjectPool.
    Parameters:
    c - the Connection to delegate all calls to.
 public 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.
    Parameters:
    c - the Connection to delegate all calls to.
    config - the configuration for tracing abandoned objects
Method from org.apache.commons.dbcp.DelegatingConnection Summary:
activate,   checkOpen,   clearWarnings,   close,   commit,   createStatement,   createStatement,   createStatement,   equals,   getAutoCommit,   getCatalog,   getDelegate,   getHoldability,   getInnermostDelegate,   getMetaData,   getTransactionIsolation,   getTypeMap,   getWarnings,   handleException,   hashCode,   innermostDelegateEquals,   isClosed,   isReadOnly,   nativeSQL,   passivate,   prepareCall,   prepareCall,   prepareCall,   prepareStatement,   prepareStatement,   prepareStatement,   prepareStatement,   prepareStatement,   prepareStatement,   releaseSavepoint,   rollback,   rollback,   setAutoCommit,   setCatalog,   setDelegate,   setHoldability,   setReadOnly,   setSavepoint,   setSavepoint,   setTransactionIsolation,   setTypeMap,   toString
Methods from org.apache.commons.dbcp.AbandonedTrace:
addTrace,   clearTrace,   getConfig,   getLastUsed,   getTrace,   printStackTrace,   removeTrace,   setLastUsed,   setLastUsed,   setStackTrace
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.dbcp.DelegatingConnection Detail:
 protected  void activate() 
 protected  void checkOpen() throws SQLException 
 public  void clearWarnings() throws SQLException 
 public  void close() throws SQLException 
    Closes the underlying connection, and close any Statements that were not explicitly closed.
 public  void commit() throws SQLException 
 public Statement createStatement() throws SQLException 
 public Statement createStatement(int resultSetType,
    int resultSetConcurrency) throws SQLException 
 public Statement createStatement(int resultSetType,
    int resultSetConcurrency,
    int resultSetHoldability) throws SQLException 
 public boolean equals(Object obj) 
 public boolean getAutoCommit() throws SQLException 
 public String getCatalog() throws SQLException 
 public Connection getDelegate() 
 public int getHoldability() throws SQLException 
 public Connection getInnermostDelegate() 
    If my underlying Connection is not a DelegatingConnection, returns it, otherwise recursively invokes this method on my delegate.

    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 .

 public DatabaseMetaData getMetaData() throws SQLException 
 public int getTransactionIsolation() throws SQLException 
 public Map getTypeMap() throws SQLException 
 public SQLWarning getWarnings() throws SQLException 
 protected  void handleException(SQLException e) throws SQLException 
 public int hashCode() 
 public boolean innermostDelegateEquals(Connection c) 
    Compares innermost delegate to the given connection.
 public boolean isClosed() throws SQLException 
 public boolean isReadOnly() throws SQLException 
 public String nativeSQL(String sql) throws SQLException 
 protected  void passivate() throws SQLException 
 public CallableStatement prepareCall(String sql) throws SQLException 
 public CallableStatement prepareCall(String sql,
    int resultSetType,
    int resultSetConcurrency) throws SQLException 
 public CallableStatement prepareCall(String sql,
    int resultSetType,
    int resultSetConcurrency,
    int resultSetHoldability) throws SQLException 
 public PreparedStatement prepareStatement(String sql) throws SQLException 
 public PreparedStatement prepareStatement(String sql,
    int autoGeneratedKeys) throws SQLException 
 public PreparedStatement prepareStatement(String sql,
    int[] columnIndexes) throws SQLException 
 public PreparedStatement prepareStatement(String sql,
    String[] columnNames) throws SQLException 
 public PreparedStatement prepareStatement(String sql,
    int resultSetType,
    int resultSetConcurrency) throws SQLException 
 public PreparedStatement prepareStatement(String sql,
    int resultSetType,
    int resultSetConcurrency,
    int resultSetHoldability) throws SQLException 
 public  void releaseSavepoint(Savepoint savepoint) throws SQLException 
 public  void rollback() throws SQLException 
 public  void rollback(Savepoint savepoint) throws SQLException 
 public  void setAutoCommit(boolean autoCommit) throws SQLException 
 public  void setCatalog(String catalog) throws SQLException 
 public  void setDelegate(Connection c) 
    Sets my delegate.
 public  void setHoldability(int holdability) throws SQLException 
 public  void setReadOnly(boolean readOnly) throws SQLException 
 public Savepoint setSavepoint() throws SQLException 
 public Savepoint setSavepoint(String name) throws SQLException 
 public  void setTransactionIsolation(int level) throws SQLException 
 public  void setTypeMap(Map map) throws SQLException 
 public String toString() 
    Returns a string representation of the metadata associated with the innnermost delegate connection.