Class PoolableCallableStatement

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.CallableStatement, java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper

    public class PoolableCallableStatement
    extends DelegatingCallableStatement
    implements java.sql.CallableStatement
    A DelegatingCallableStatement that cooperates with PoolingConnection to implement a pool of CallableStatements.

    The close() method returns this statement to its containing pool. (See PoolingConnection.)

    Since:
    1.3
    Version:
    $Revision: 883040 $ $Date: 2009-11-22 01:01:20 -0500 (Sun, 22 Nov 2009) $
    See Also:
    PoolingConnection
    • Constructor Detail

      • PoolableCallableStatement

        public PoolableCallableStatement​(java.sql.CallableStatement stmt,
                                         java.lang.Object key,
                                         org.apache.commons.pool.KeyedObjectPool pool,
                                         java.sql.Connection conn)
        Constructor.
        Parameters:
        stmt - the underlying CallableStatement
        key - the key for this statement in the KeyedObjectPool
        pool - the KeyedObjectPool from which this CallableStatement was obtained
        conn - the Connection that created this CallableStatement
    • Method Detail

      • close

        public void close()
                   throws java.sql.SQLException
        Returns the CallableStatement to the pool. If {DelegatingStatement.isClosed(), this is a No-op.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.sql.Statement
        Overrides:
        close in class DelegatingStatement
        Throws:
        java.sql.SQLException
      • activate

        protected void activate()
                         throws java.sql.SQLException
        Activates after retrieval from the pool. Adds a trace for this CallableStatement to the Connection that created it.
        Overrides:
        activate in class DelegatingStatement
        Throws:
        java.sql.SQLException
      • passivate

        protected void passivate()
                          throws java.sql.SQLException
        Passivates to prepare for return to the pool. Removes the trace associated with this CallableStatement from the Connection that created it. Also closes any associated ResultSets.
        Overrides:
        passivate in class DelegatingStatement
        Throws:
        java.sql.SQLException
      • getObject

        public <T> T getObject​(java.lang.String columnLabel,
                               java.lang.Class<T> type)
                        throws java.sql.SQLException
        Specified by:
        getObject in interface java.sql.CallableStatement
        Overrides:
        getObject in class DelegatingCallableStatement
        Throws:
        java.sql.SQLException
      • getObject

        public <T> T getObject​(int columnIndex,
                               java.lang.Class<T> type)
                        throws java.sql.SQLException
        Specified by:
        getObject in interface java.sql.CallableStatement
        Overrides:
        getObject in class DelegatingCallableStatement
        Throws:
        java.sql.SQLException