Class PoolableConnection

All Implemented Interfaces:
AutoCloseable, Connection, Wrapper, PoolableConnectionMXBean, TrackedUse
Direct Known Subclasses:
PoolableManagedConnection

public class PoolableConnection extends DelegatingConnection<Connection> implements PoolableConnectionMXBean
A delegating connection that, rather than closing the underlying connection, returns itself to an ObjectPool when closed.
Since:
2.0
  • Constructor Details

    • PoolableConnection

      public PoolableConnection(Connection conn, ObjectPool<PoolableConnection> pool, ObjectName jmxName)
      Parameters:
      conn - my underlying connection
      pool - the pool to which I should return when closed
      jmxName - JMX name
    • PoolableConnection

      public PoolableConnection(Connection conn, ObjectPool<PoolableConnection> pool, ObjectName jmxObjectName, Collection<String> disconnectSqlCodes, boolean fastFailValidation)
      Parameters:
      conn - my underlying connection
      pool - the pool to which I should return when closed
      jmxObjectName - JMX name
      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)
    • PoolableConnection

      public PoolableConnection(Connection conn, ObjectPool<PoolableConnection> pool, ObjectName jmxObjectName, Collection<String> disconnectSqlCodes, Collection<String> disconnectionIgnoreSqlCodes, boolean fastFailValidation)
      Creates a new PoolableConnection instance.
      Parameters:
      conn - my underlying connection
      pool - the pool to which I should return when closed
      jmxObjectName - JMX name
      disconnectSqlCodes - SQL State codes considered fatal disconnection errors
      disconnectionIgnoreSqlCodes - SQL State codes that should be ignored when determining 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