Class PoolableCallableStatement

All Implemented Interfaces:
AutoCloseable, CallableStatement, PreparedStatement, Statement, Wrapper, org.apache.commons.pool2.TrackedUse

public class PoolableCallableStatement extends DelegatingCallableStatement
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:
2.0
See Also:
  • Field Details

    • pool

      private final org.apache.commons.pool2.KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool
      The KeyedObjectPool from which this CallableStatement was obtained.
    • key

      private final PStmtKey key
      Key for this statement in the containing KeyedObjectPool.
  • Constructor Details

  • Method Details

    • activate

      public void activate() throws 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:
      SQLException - thrown by the delegating statement.
      Since:
      2.4.0 made public, was protected in 2.3.0.
    • close

      public void close() throws SQLException
      Returns the CallableStatement to the pool. If {DelegatingStatement.isClosed(), this is a No-op.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Statement
      Overrides:
      close in class DelegatingStatement
      Throws:
      SQLException - Ignored here, for subclasses.
    • passivate

      public void passivate() throws 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:
      SQLException - thrown by the delegating statement.
      Since:
      2.4.0 made public, was protected in 2.3.0.