org.apache.commons.dbcp2.managed

## Class PoolableManagedConnectionFactory

- java.lang.Object
- - org.apache.commons.dbcp2.PoolableConnectionFactory
  - - org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory

- All Implemented Interfaces:
    org.apache.commons.pool2.PooledObjectFactory<PoolableConnection>

      public class PoolableManagedConnectionFactory
      extends PoolableConnectionFactory

  A `PoolableConnectionFactory` that creates `PoolableManagedConnection`s.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PoolableManagedConnectionFactory(XAConnectionFactory connFactory, ObjectName dataSourceJmxName)` Create a PoolableManagedConnectionFactory and attach it to a connection pool.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.commons.pool2.PooledObject<PoolableConnection>` | `makeObject()` Uses the configured XAConnectionFactory to create a `PoolableManagedConnection`.

    - ### Methods inherited from class org.apache.commons.dbcp2.PoolableConnectionFactory

      `activateObject, destroyObject, getCacheState, getConnectionFactory, getDefaultQueryTimeout, getMaxOpenPreparedStatements, getPool, getPoolStatements, initializeConnection, isEnableAutoCommitOnReturn, isRollbackOnReturn, passivateObject, setCacheState, setConnectionInitSql, setDefaultAutoCommit, setDefaultCatalog, setDefaultQueryTimeout, setDefaultReadOnly, setDefaultTransactionIsolation, setEnableAutoCommitOnReturn, setMaxConnLifetimeMillis, setMaxOpenPrepatedStatements, setPool, setPoolStatements, setRollbackOnReturn, 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,
                                          ObjectName dataSourceJmxName)

      Create a PoolableManagedConnectionFactory and attach it to a connection pool.
      Parameters:
        `connFactory` - XAConnectionFactory

  - ### Method Detail

    - #### makeObject

          public org.apache.commons.pool2.PooledObject<PoolableConnection> 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 `org.apache.commons.pool2.PooledObjectFactory<PoolableConnection>`
      Overrides:
        `makeObject` in class `PoolableConnectionFactory`
      Throws:
        `Exception`

Copyright © 2001–2014 The Apache Software Foundation. All rights reserved.