org.apache.commons.dbcp.managed
Class PoolableManagedConnectionFactory

java.lang.Object
  extended by org.apache.commons.dbcp.PoolableConnectionFactory
      extended by org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory
All Implemented Interfaces:
PoolableObjectFactory

public class PoolableManagedConnectionFactory
extends PoolableConnectionFactory

A PoolableConnectionFactory that creates PoolableManagedConnections.

Version:
$Revision$ $Date$

Field Summary
 
Fields inherited from class org.apache.commons.dbcp.PoolableConnectionFactory
_config, _connectionInitSqls, _connFactory, _defaultAutoCommit, _defaultCatalog, _defaultReadOnly, _defaultTransactionIsolation, _pool, _stmtPoolFactory, _validationQuery, _validationQueryTimeout
 
Constructor Summary
PoolableManagedConnectionFactory(XAConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
          Create a PoolableManagedConnectionFactory and attach it to a connection pool.
PoolableManagedConnectionFactory(XAConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Collection connectionInitSqls, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
          Create a PoolableManagedConnectionFactory and attach it to a connection pool.
 
Method Summary
 Object makeObject()
          Uses the configured XAConnectionFactory to create a PoolableManagedConnection.
 
Methods inherited from class org.apache.commons.dbcp.PoolableConnectionFactory
activateObject, destroyObject, getPool, initializeConnection, passivateObject, setConnectionFactory, setConnectionInitSql, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setPool, setStatementPoolFactory, setValidationQuery, setValidationQueryTimeout, validateConnection, validateObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolableManagedConnectionFactory

public PoolableManagedConnectionFactory(XAConnectionFactory connFactory,
                                        ObjectPool pool,
                                        KeyedObjectPoolFactory stmtPoolFactory,
                                        String validationQuery,
                                        boolean defaultReadOnly,
                                        boolean defaultAutoCommit)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.

Parameters:
connFactory - XAConnectionFactory
pool - connection pool
stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
defaultReadOnly - the default "read only" setting for borrowed Connections
defaultAutoCommit - the default "auto commit" setting for returned Connections

PoolableManagedConnectionFactory

public PoolableManagedConnectionFactory(XAConnectionFactory connFactory,
                                        ObjectPool pool,
                                        KeyedObjectPoolFactory stmtPoolFactory,
                                        String validationQuery,
                                        int validationQueryTimeout,
                                        Collection connectionInitSqls,
                                        Boolean defaultReadOnly,
                                        boolean defaultAutoCommit,
                                        int defaultTransactionIsolation,
                                        String defaultCatalog,
                                        AbandonedConfig config)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.

Parameters:
connFactory - XAConnectionFactory
pool - connection pool
stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.
connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.
defaultReadOnly - the default "read only" setting for borrowed Connections
defaultAutoCommit - the default "auto commit" setting for returned Connections
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
defaultCatalog - the default "catalog" setting for returned Connections
config - the AbandonedConfig if tracing SQL objects
Method Detail

makeObject

public Object makeObject()
                  throws Exception
Uses the configured XAConnectionFactory to create a PoolableManagedConnection. Throws IllegalStateException if the connection factory returns null. Also initializes the connection using configured initialization sql (if provided) and sets up a prepared statement pool associated with the PoolableManagedConnection if statement pooling is enabled.

Specified by:
makeObject in interface PoolableObjectFactory
Overrides:
makeObject in class PoolableConnectionFactory
Throws:
Exception


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.