Interface TransactionAware


public interface TransactionAware
Interface to be implemented by a resource (a connection) that the transaction integration layer will manipulate.
Author:
Luis Barreiro, Jesper Pedersen
  • Method Details

    • transactionStart

      void transactionStart() throws SQLException
      The resource it's now enlisted with a transaction.
      Throws:
      SQLException
    • transactionBeforeCompletion

      void transactionBeforeCompletion(boolean successful)
      The transaction is about to complete.
      Parameters:
      successful - If the transaction is to complete successfully (commit) or unsuccessfully (rollback)
    • transactionCommit

      void transactionCommit() throws SQLException
      The resource must commit.
      Throws:
      SQLException
    • transactionRollback

      void transactionRollback() throws SQLException
      The resource must rollback.
      Throws:
      SQLException
    • transactionEnd

      void transactionEnd() throws SQLException
      The transaction ended and the resource is no longer enlisted.
      Throws:
      SQLException
    • transactionCheckCallback

      void transactionCheckCallback(TransactionAware.SQLCallable<Boolean> transactionCheck)
      Set a callback trap to prevent lazy / deferred enlistment. Agroal supports neither of those features. This callback is set when the resource is obtained outside the scope of a running transaction and allows the resource to check if it's used within a transaction later on.
    • getConnection

      Object getConnection()
      Gets access to the raw Connection held by the resource.
    • setFlushOnly

      void setFlushOnly()
      The resource is no longer valid and should not be returned to the pool.