Package org.apache.commons.dbcp2.managed

# Class PoolableManagedConnection

java.lang.Object
org.apache.commons.dbcp2.AbandonedTrace
org.apache.commons.dbcp2.DelegatingConnection<Connection>
org.apache.commons.dbcp2.PoolableConnection
org.apache.commons.dbcp2.managed.PoolableManagedConnection

All Implemented Interfaces:
  `AutoCloseable`, `Connection`, `Wrapper`, `PoolableConnectionMXBean`, `TrackedUse`

public class PoolableManagedConnection extends PoolableConnection
PoolableConnection that unregisters from TransactionRegistry on Connection real destroy.

Since:
  2.0
See Also:
  - `PoolableConnection`

- ## Field Summary

  ### Fields inherited from interface java.sql.Connection

  `TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool)`
  Creates a PoolableManagedConnection.
  `PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool, Collection<String> disconnectSqlCodes, boolean fastFailValidation)`
  Creates a PoolableManagedConnection.
  `PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool, Collection<String> disconnectSqlCodes, Collection<String> disconnectionIgnoreSqlCodes, boolean fastFailValidation)`
  Creates a PoolableManagedConnection.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TransactionRegistry`
  `getTransactionRegistry()`
  Gets the transaction registry.
  `void`
  `reallyClose()`
  Actually close the underlying connection.

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

  `abort, close, getDisconnectionSqlCodes, getToString, handleException, isClosed, isFastFailValidation, passivate, setLastUsed, validate, validate`

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

  `activate, checkOpen, clearCachedState, clearWarnings, closeInternal, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCacheState, getCatalog, getClientInfo, getClientInfo, getDefaultQueryTimeout, getDefaultQueryTimeoutDuration, getDelegate, getDelegateInternal, getHoldability, getInnermostDelegate, getInnermostDelegateInternal, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, handleExceptionNoThrow, innermostDelegateEquals, isClosedInternal, isReadOnly, isValid, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCacheState, setCatalog, setClientInfo, setClientInfo, setClosedInternal, setDefaultQueryTimeout, setDefaultQueryTimeout, setDelegate, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrap`

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

  `addTrace, clearTrace, close, getLastUsed, getLastUsedInstant, getTrace, removeThisTrace, removeTrace, setLastUsed, setLastUsed`

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

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

  ### Methods inherited from interface org.apache.commons.dbcp2.PoolableConnectionMXBean

  `clearCachedState, clearWarnings, getAutoCommit, getCacheState, getCatalog, getHoldability, getSchema, getTransactionIsolation, isReadOnly, setAutoCommit, setCacheState, setCatalog, setHoldability, setReadOnly, setSchema, setTransactionIsolation`

- ## Constructor Details

  - ### PoolableManagedConnection

    public PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool)
    Creates a PoolableManagedConnection.
    Parameters:
      `transactionRegistry` - transaction registry
      `conn` - underlying connection
      `pool` - connection pool

  - ### PoolableManagedConnection

    public PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool, Collection<String> disconnectSqlCodes, boolean fastFailValidation)
    Creates a PoolableManagedConnection.
    Parameters:
      `transactionRegistry` - transaction registry
      `conn` - underlying connection
      `pool` - connection pool
      `disconnectSqlCodes` - SQL State codes considered fatal disconnection errors
      `fastFailValidation` - true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to run query or isValid)

  - ### PoolableManagedConnection

    public PoolableManagedConnection(TransactionRegistry transactionRegistry, Connection conn, ObjectPool<PoolableConnection> pool, Collection<String> disconnectSqlCodes, Collection<String> disconnectionIgnoreSqlCodes, boolean fastFailValidation)
    Creates a PoolableManagedConnection.
    Parameters:
      `transactionRegistry` - transaction registry
      `conn` - underlying connection
      `pool` - connection pool
      `disconnectSqlCodes` - SQL State codes considered fatal disconnection errors
      `disconnectionIgnoreSqlCodes` - SQL State codes considered fatal disconnection errors
      `fastFailValidation` - true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to run query or isValid)
    Since:
      2.13.0

- ## Method Details

  - ### getTransactionRegistry

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

  - ### reallyClose

    public void reallyClose() throws SQLException
    Actually close the underlying connection.
    Specified by:
      `reallyClose` in interface `PoolableConnectionMXBean`
    Overrides:
      `reallyClose` in class `PoolableConnection`
    Throws:
      `SQLException` - Thrown if the connection can be closed.