Interface PooledResourceUser

All Superinterfaces:
OracleResourceUser

public interface PooledResourceUser extends OracleResourceUser
What DaoFactoryPool needs from a poolable DAO factory. Generated <Factory> classes implement this when the config sets DAO_POOL=YES.

The point of pooling a factory rather than a Connection is that a factory carries far more warm state than its connection: one cached instance of every DAO, each holding its own parsed CallableStatements. A connection pool would hand back a bare connection and every borrower would re-parse. So settleTransaction(boolean) deliberately does not release resources — OracleResourceUser.releaseResources() is for teardown, not for the return leg of a borrow.

The cost of that choice is that a pool of N factories pins N Oracle sessions and N × (DAOs per factory) × (statements per DAO) cursors. Size DAO_POOL_MAX_SIZE against the server's open_cursors and sessions, not against CPU.

Implementations are not thread-safe, and the pool does not make them so — it guarantees only that one borrower holds a given factory at a time. Never retain a reference to a factory after returning it. Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Release everything: statements, DAOs and the connection itself.
    void
    Establish the database connection if there is not already a usable one.
    boolean
    Is this factory's connection still usable?
    void
    settleTransaction(boolean commit)
    End the transaction opened by whoever just finished with this factory, so the next borrower starts clean.

    Methods inherited from interface com.mcpdbwizard.pub.OracleResourceUser

    hasResources, releaseResources
  • Method Details

    • confirmConnection

      void confirmConnection() throws CSException
      Establish the database connection if there is not already a usable one. Called when the pool creates a factory and again each time one is handed out, so an implementation must be cheap and idempotent when already connected. Re-connecting here is what lets a factory whose session died survive as a pool member.
      Throws:
      CSException - if no connection could be established
    • isConnectionUsable

      boolean isConnectionUsable()
      Is this factory's connection still usable? Used to validate a factory before it is handed out and, in the background, while it sits idle. Must never throw: a factory that cannot answer the question is by definition not usable.
      Returns:
      true if the connection is open and the session is alive
    • settleTransaction

      void settleTransaction(boolean commit) throws CSException
      End the transaction opened by whoever just finished with this factory, so the next borrower starts clean. Called on the return leg of every borrow. Does not release statements or DAOs — see the class comment.
      Parameters:
      commit - true to commit the borrower's work, false to roll it back. The pool always passes false when the borrower threw.
      Throws:
      CSException - if the transaction could not be settled, which the pool treats as grounds to destroy this factory rather than reuse it
    • closeFactory

      void closeFactory()
      Release everything: statements, DAOs and the connection itself. Called when the pool evicts an idle factory, discards a broken one, or is closed. Never throws — a factory being destroyed has nowhere to report a failure to.