Class PoolingDataSource.PoolGuardConnectionWrapper<D extends java.sql.Connection>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper, TrackedUse
    Enclosing class:
    PoolingDataSource<C extends java.sql.Connection>

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

      • PoolGuardConnectionWrapper

        PoolGuardConnectionWrapper​(D 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<D extends java.sql.Connection>
        Returns:
        innermost delegate.
        See Also:
        DelegatingConnection.getInnermostDelegate()
      • close

        public void close()
                   throws java.sql.SQLException
        Description copied from class: DelegatingConnection
        Closes the underlying connection, and close any Statements that were not explicitly closed. Sub-classes that override this method must:
        1. Call passivate()
        2. Call close (or the equivalent appropriate action) on the wrapped connection
        3. Set _closed to false
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.sql.Connection
        Overrides:
        close in class DelegatingConnection<D extends java.sql.Connection>
        Throws:
        java.sql.SQLException
      • isClosed

        public boolean isClosed()
                         throws java.sql.SQLException
        Specified by:
        isClosed in interface java.sql.Connection
        Overrides:
        isClosed in class DelegatingConnection<D extends java.sql.Connection>
        Throws:
        java.sql.SQLException