Interface SubordinateTransaction

All Superinterfaces:
org.jboss.tm.ImportedTransaction, jakarta.transaction.Transaction
All Known Implementing Classes:
TransactionImple, TransactionImple

public interface SubordinateTransaction extends org.jboss.tm.ImportedTransaction
Subordinate transactions are those designed to be driven by a foreign controller, so they expose methods for driving each of the termination phases individually.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
     
    boolean
    Run beforeCompletion on Synchronizations.
    boolean
    Drive the subordinate transaction to commit.
    void
    Called to tell the transaction to forget any heuristics.
    void
    Drive the transaction to commit.
    int
    Drive the subordinate transaction through the prepare phase.
    void
    Drive the subordinate transaction to roll back.
     
    Listing deferred throwables gathered during the transaction processing.
    void
     
    boolean
    Informs if deferred throwables are supported by implementation.

    Methods inherited from interface org.jboss.tm.ImportedTransaction

    getId

    Methods inherited from interface jakarta.transaction.Transaction

    commit, delistResource, enlistResource, getStatus, registerSynchronization, rollback, setRollbackOnly
  • Method Details

    • doPrepare

      int doPrepare()
      Drive the subordinate transaction through the prepare phase. Any enlisted participants will also be prepared as a result.
      Specified by:
      doPrepare in interface org.jboss.tm.ImportedTransaction
      Returns:
      a TwoPhaseOutcome representing the result.
    • doCommit

      boolean doCommit() throws IllegalStateException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, jakarta.transaction.HeuristicCommitException, jakarta.transaction.SystemException
      Drive the subordinate transaction to commit. It must have previously been prepared.
      Specified by:
      doCommit in interface org.jboss.tm.ImportedTransaction
      Returns:
      true, if the transaction was fully committed, false if there was a transient error
      Throws:
      IllegalStateException - thrown if the transaction has not been prepared or is unknown.
      jakarta.transaction.HeuristicMixedException - thrown if a heuristic mixed outcome occurs (where some participants committed whilst others rolled back).
      jakarta.transaction.HeuristicRollbackException - thrown if the transaction rolled back.
      jakarta.transaction.SystemException - thrown if some other error occurs.
      jakarta.transaction.HeuristicCommitException
    • doRollback

      void doRollback() throws IllegalStateException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicCommitException, jakarta.transaction.HeuristicRollbackException, jakarta.transaction.SystemException
      Drive the subordinate transaction to roll back. It need not have been previously prepared.
      Specified by:
      doRollback in interface org.jboss.tm.ImportedTransaction
      Throws:
      IllegalStateException - thrown if the transaction is not known by the system or has been previously terminated.
      jakarta.transaction.HeuristicMixedException - thrown if a heuristic mixed outcome occurs (can only happen if the transaction was previously prepared and then only if some participants commit whilst others roll back).
      jakarta.transaction.HeuristicCommitException - thrown if the transaction commits (can only happen if it was previously prepared).
      jakarta.transaction.SystemException - thrown if any other error occurs.
      jakarta.transaction.HeuristicRollbackException
    • doOnePhaseCommit

      void doOnePhaseCommit() throws IllegalStateException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.SystemException, jakarta.transaction.RollbackException
      Drive the transaction to commit. It should not have been previously prepared and will be the only resource in the global transaction.
      Specified by:
      doOnePhaseCommit in interface org.jboss.tm.ImportedTransaction
      Throws:
      IllegalStateException - if the transaction has already terminated
      jakarta.transaction.HeuristicRollbackException - thrown if the transaction rolls back.
      jakarta.transaction.HeuristicMixedException
      jakarta.transaction.SystemException
      jakarta.transaction.RollbackException
    • doForget

      void doForget() throws IllegalStateException
      Called to tell the transaction to forget any heuristics.
      Specified by:
      doForget in interface org.jboss.tm.ImportedTransaction
      Throws:
      IllegalStateException - thrown if the transaction cannot be found.
    • doBeforeCompletion

      boolean doBeforeCompletion() throws jakarta.transaction.SystemException
      Run beforeCompletion on Synchronizations. Note: this will run beforeCompletion even on setRollbackOnly transactions. Users may wish to avoid calling this method in such cases, or prior to calling rollback.
      Specified by:
      doBeforeCompletion in interface org.jboss.tm.ImportedTransaction
      Returns:
      outcome
      Throws:
      jakarta.transaction.SystemException
    • activated

      boolean activated()
      Specified by:
      activated in interface org.jboss.tm.ImportedTransaction
    • recover

      void recover()
      Specified by:
      recover in interface org.jboss.tm.ImportedTransaction
    • baseXid

      Xid baseXid()
      Specified by:
      baseXid in interface org.jboss.tm.ImportedTransaction
    • get_uid

      Uid get_uid()
    • getDeferredThrowables

      List<Throwable> getDeferredThrowables()

      Listing deferred throwables gathered during the transaction processing. This list contains exceptions thrown by transaction resources when an error occurs.

      Depending on the transaction stage the particular method returns only an error code e.g. ImportedTransaction.doPrepare() then the controller of the subordinate transaction throws its own exception and it could pack these throwables in some details. Other methods as ImportedTransaction.doCommit() throws an exception but those exception does not contain underlying exceptions like those coming from resource failures.

      Normally exceptions taken by this call are put under suppressed part of the thrown exception.

      JTS implementation of the SubordinateTransaction interface does not support the deferred throwable based on the limitation of ORB protocol. This method called on JTS implementation causes UnsupportedOperationException being thrown.

      Specified by:
      getDeferredThrowables in interface org.jboss.tm.ImportedTransaction
      Returns:
      list of throwables causing the failure state of the transaction
    • supportsDeferredThrowables

      boolean supportsDeferredThrowables()

      Informs if deferred throwables are supported by implementation. See ImportedTransaction.getDeferredThrowables().

      • JTS does not support deffered throwable, you can expect false.
      • JTA suppors deffered throwable, you can expect true.
      Specified by:
      supportsDeferredThrowables in interface org.jboss.tm.ImportedTransaction
      Returns:
      true, if getting deffered throwables is supported by subordinate transaction implementation, false otherwise