Package org.apache.commons.dbcp2.managed

# Class PoolableManagedConnectionFactory

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

All Implemented Interfaces:
  `PooledObjectFactory<PoolableConnection>`

public class PoolableManagedConnectionFactory extends PoolableConnectionFactory
A `PoolableConnectionFactory` that creates `PoolableManagedConnection`s.

Since:
  2.0

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TransactionRegistry`
  `getTransactionRegistry()`
  Gets the transaction registry.
  `PooledObject<PoolableConnection>`
  `makeObject()`
  Uses the configured XAConnectionFactory to create a `PoolableManagedConnection`.

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

  `activateObject, destroyObject, destroyObject, getCacheState, getConnectionFactory, getConnectionIndex, getConnectionInitSqls, getDataSourceJmxName, getDataSourceJmxObjectName, getDefaultAutoCommit, getDefaultCatalog, getDefaultQueryTimeout, getDefaultQueryTimeoutDuration, getDefaultQueryTimeoutSeconds, getDefaultReadOnly, getDefaultSchema, getDefaultTransactionIsolation, getDisconnectionIgnoreSqlCodes, getDisconnectionSqlCodes, getMaxConnDuration, getMaxConnLifetimeMillis, getMaxOpenPreparedStatements, getPool, getPoolStatements, getValidationQuery, getValidationQueryTimeoutDuration, getValidationQueryTimeoutSeconds, initializeConnection, isAutoCommitOnReturn, isEnableAutoCommitOnReturn, isFastFailValidation, isRollbackOnReturn, passivateObject, setAutoCommitOnReturn, setCacheState, setClearStatementPoolOnReturn, setConnectionInitSql, setDefaultAutoCommit, setDefaultCatalog, setDefaultQueryTimeout, setDefaultQueryTimeout, setDefaultReadOnly, setDefaultSchema, setDefaultTransactionIsolation, setDisconnectionIgnoreSqlCodes, setDisconnectionSqlCodes, setEnableAutoCommitOnReturn, setFastFailValidation, setMaxConn, setMaxConnLifetimeMillis, setMaxOpenPreparedStatements, setMaxOpenPrepatedStatements, setPool, setPoolStatements, setRollbackOnReturn, setValidationQuery, setValidationQueryTimeout, setValidationQueryTimeout, validateConnection, validateObject`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PoolableManagedConnectionFactory

    public PoolableManagedConnectionFactory(XAConnectionFactory connFactory, ObjectName dataSourceJmxName)
    Creates a PoolableManagedConnectionFactory and attach it to a connection pool.
    Parameters:
      `connFactory` - XAConnectionFactory
      `dataSourceJmxName` - The data source name.

- ## Method Details

  - ### getTransactionRegistry

    public TransactionRegistry getTransactionRegistry()
    Gets the transaction registry.
    Returns:
      The transaction registry.
    Since:
      2.6.0

  - ### makeObject

    public PooledObject<PoolableConnection> makeObject() throws SQLException
    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 `PooledObjectFactory<PoolableConnection>`
    Overrides:
      `makeObject` in class `PoolableConnectionFactory`
    Throws:
      `SQLException`