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

All Implemented Interfaces:
    ConnectionEventListener, KeyedPoolableObjectFactory

A {*link PoolableObjectFactory} that creates {*link PoolableConnection}s.
Field Summary
protected  ConnectionPoolDataSource _cpds     
protected  String _validationQuery     
protected  boolean _rollbackAfterValidation     
protected  KeyedObjectPool _pool     
Constructor:
 public KeyedCPDSConnectionFactory(ConnectionPoolDataSource cpds,
    KeyedObjectPool pool,
    String validationQuery) 
    Create a new KeyedPoolableConnectionFactory.
    Parameters:
    cpds - the ConnectionPoolDataSource from which to obtain PooledConnection's
    pool - the {*link ObjectPool} in which to pool those {*link Connection}s
    validationQuery - a query to use to {*link #validateObject validate} {*link Connection}s. Should return at least one row. May be null
 public KeyedCPDSConnectionFactory(ConnectionPoolDataSource cpds,
    KeyedObjectPool pool,
    String validationQuery,
    boolean rollbackAfterValidation) 
    Create a new KeyedPoolableConnectionFactory.
    Parameters:
    cpds - the ConnectionPoolDataSource from which to obtain PooledConnections
    pool - the ObjectPool in which to pool those Connection s
    validationQuery - a query to use to validate Connection s. Should return at least one row. May be null
    rollbackAfterValidation - whether a rollback should be issued after validating Connection s.
Method from org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory Summary:
activateObject,   connectionClosed,   connectionErrorOccurred,   destroyObject,   getPool,   makeObject,   passivateObject,   setCPDS,   setPool,   setRollbackAfterValidation,   setValidationQuery,   validateObject
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory Detail:
 public  void activateObject(Object key,
    Object obj) 
 public  void connectionClosed(ConnectionEvent event) 
    This will be called if the Connection returned by the getConnection method came from a PooledConnection, and the user calls the close() method of this connection object. What we need to do here is to release this PooledConnection from our pool...
 public  void connectionErrorOccurred(ConnectionEvent event) 
    If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
 public  void destroyObject(Object key,
    Object obj) throws Exception 
 public KeyedObjectPool getPool() 
 public synchronized Object makeObject(Object key) throws Exception 
 public  void passivateObject(Object key,
    Object obj) 
 public synchronized  void setCPDS(ConnectionPoolDataSource cpds) 
 public synchronized  void setPool(KeyedObjectPool pool) throws SQLException 
    Sets the {*link ObjectPool} in which to pool {*link Connection}s.
 public synchronized  void setRollbackAfterValidation(boolean rollbackAfterValidation) 
    Sets whether a rollback should be issued after {*link #validateObject validating} {*link Connection}s.
 public synchronized  void setValidationQuery(String validationQuery) 
    Sets the query I use to {*link #validateObject validate} {*link Connection}s. Should return at least one row. May be null
 public boolean validateObject(Object key,
    Object obj)