Class PoolableConnection

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper
    Direct Known Subclasses:
    PoolableManagedConnection

    public class PoolableConnection
    extends DelegatingConnection
    A delegating connection that, rather than closing the underlying connection, returns itself to an ObjectPool when closed.
    Version:
    $Revision: 758745 $ $Date: 2009-03-26 13:02:20 -0400 (Thu, 26 Mar 2009) $
    Author:
    Rodney Waldhoff, Glenn L. Nielsen, James House
    • Field Detail

      • _pool

        protected org.apache.commons.pool.ObjectPool _pool
        The pool to which I should return.
    • Constructor Detail

      • PoolableConnection

        public PoolableConnection​(java.sql.Connection conn,
                                  org.apache.commons.pool.ObjectPool pool)
        Parameters:
        conn - my underlying connection
        pool - the pool to which I should return when closed
      • PoolableConnection

        public PoolableConnection​(java.sql.Connection conn,
                                  org.apache.commons.pool.ObjectPool pool,
                                  AbandonedConfig config)
        Parameters:
        conn - my underlying connection
        pool - the pool to which I should return when closed
        config - the abandoned configuration settings
    • Method Detail

      • close

        public void close()
                   throws java.sql.SQLException
        Returns me to my pool.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.sql.Connection
        Overrides:
        close in class DelegatingConnection
        Throws:
        java.sql.SQLException
      • reallyClose

        public void reallyClose()
                         throws java.sql.SQLException
        Actually close my underlying Connection.
        Throws:
        java.sql.SQLException