Package org.apache.commons.dbcp.managed
Class PoolableManagedConnectionFactory
- java.lang.Object
-
- org.apache.commons.dbcp.PoolableConnectionFactory
-
- org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory
-
- All Implemented Interfaces:
org.apache.commons.pool.PoolableObjectFactory
public class PoolableManagedConnectionFactory extends PoolableConnectionFactory
APoolableConnectionFactory
that createsPoolableManagedConnection
s.- 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
Constructors Constructor Description PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, java.lang.String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, java.lang.String validationQuery, int validationQueryTimeout, java.util.Collection connectionInitSqls, java.lang.Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, java.lang.String defaultCatalog, AbandonedConfig config)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
makeObject()
Uses the configured XAConnectionFactory to create aPoolableManagedConnection
.-
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
-
-
-
-
Constructor Detail
-
PoolableManagedConnectionFactory
public PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, java.lang.String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.- Parameters:
connFactory
- XAConnectionFactorypool
- connection poolstmtPoolFactory
- theKeyedObjectPoolFactory
to use to createKeyedObjectPool
s for poolingPreparedStatement
s, or null to disablePreparedStatement
poolingvalidationQuery
- a query to use tovalidate
Connection
s. Should return at least one row. Using null turns off validation.defaultReadOnly
- the default "read only" setting for borrowedConnection
sdefaultAutoCommit
- the default "auto commit" setting for returnedConnection
s
-
PoolableManagedConnectionFactory
public PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, java.lang.String validationQuery, int validationQueryTimeout, java.util.Collection connectionInitSqls, java.lang.Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, java.lang.String defaultCatalog, AbandonedConfig config)
Create a PoolableManagedConnectionFactory and attach it to a connection pool.- Parameters:
connFactory
- XAConnectionFactorypool
- connection poolstmtPoolFactory
- theKeyedObjectPoolFactory
to use to createKeyedObjectPool
s for poolingPreparedStatement
s, or null to disablePreparedStatement
poolingvalidationQuery
- a query to use tovalidate
Connection
s. 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 initializeConnection
s. Using null turns off initialization.defaultReadOnly
- the default "read only" setting for borrowedConnection
sdefaultAutoCommit
- the default "auto commit" setting for returnedConnection
sdefaultTransactionIsolation
- the default "Transaction Isolation" setting for returnedConnection
sdefaultCatalog
- the default "catalog" setting for returnedConnection
sconfig
- the AbandonedConfig if tracing SQL objects
-
-
Method Detail
-
makeObject
public java.lang.Object makeObject() throws java.lang.Exception
Uses the configured XAConnectionFactory to create aPoolableManagedConnection
. ThrowsIllegalStateException
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 interfaceorg.apache.commons.pool.PoolableObjectFactory
- Overrides:
makeObject
in classPoolableConnectionFactory
- Throws:
java.lang.Exception
-
-