Class PoolingDriver.PoolGuardConnectionWrapper

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper, TrackedUse
    Enclosing class:
    PoolingDriver

    private class PoolingDriver.PoolGuardConnectionWrapper
    extends DelegatingConnection<java.sql.Connection>
    PoolGuardConnectionWrapper is a Connection wrapper that makes sure a closed connection cannot be used anymore.
    Since:
    2.0
    • Field Detail

      • pool

        private final ObjectPool<? extends java.sql.Connection> pool
    • Constructor Detail

      • PoolGuardConnectionWrapper

        PoolGuardConnectionWrapper​(ObjectPool<? extends java.sql.Connection> pool,
                                   java.sql.Connection delegate)
    • Method Detail

      • getInnermostDelegate

        public java.sql.Connection getInnermostDelegate()
        Description copied from class: DelegatingConnection
        If my underlying Connection is not a DelegatingConnection, returns it, otherwise recursively invokes this method on my delegate.

        Hence this method will return the first delegate that is not a DelegatingConnection, or null when no non-DelegatingConnection delegate can be found by traversing this chain.

        This method is useful when you may have nested DelegatingConnections, and you want to make sure to obtain a "genuine" Connection.

        Overrides:
        getInnermostDelegate in class DelegatingConnection<java.sql.Connection>
        Returns:
        innermost delegate.
        See Also:
        DelegatingConnection.getInnermostDelegate()