Class TrmUserTransaction

java.lang.Object
com.oracle.microtx.xa.rm.MicroTxUserTransaction
oracle.tmm.jta.TrmUserTransaction
All Implemented Interfaces:
jakarta.transaction.UserTransaction

public class TrmUserTransaction extends com.oracle.microtx.xa.rm.MicroTxUserTransaction
The OTMM(MicroTx) user transaction defines the methods that allow an application to explicitly manage transaction boundaries.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields inherited from class com.oracle.microtx.xa.rm.MicroTxUserTransaction

    gtrid, insProperties, NO_TX_CUR_THREAD, rollbackOnly, suspended, timeout, txnExternalUrl, txnInternalUrl, txnUrl
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize a new OTMM(MicroTx) user transaction
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Creates a new transaction and associates it with the current thread.
    void
    begin(Boolean enlist)
     
    void
    Commit the transaction associated with the current thread.
    protected void
    finalize make sure relevant ThreadLocal objects are removed in case of bug in application code where commit/rollback has not been called.
    int
    Obtain the status of the transaction associated with the current thread.
    Get OTMM(MicroTx) user transaction ID associated with the current thread
    Get OTMM(MicroTx) user transaction external URL
    Get OTMM(MicroTx) user transaction internal URL
     
    void
    Resume the transaction.
    void
    Roll back the transaction associated with the current thread.
    void
    setProperty(String propertyName, Object propertyValue)
     
    void
    Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
    void
    setTransactionTimeout(int timeout)
    Modify the timeout value that is associated with transactions started by the current thread with the begin method.
    void
    Start the Golbal Transaction with the TCS
    void
    Suspend the transaction.

    Methods inherited from class com.oracle.microtx.xa.rm.MicroTxUserTransaction

    getInsProperties, getTransactionTimeout, setInsProperties

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TrmUserTransaction

      public TrmUserTransaction()
      Initialize a new OTMM(MicroTx) user transaction
  • Method Details

    • begin

      public void begin() throws IllegalStateException, jakarta.transaction.SystemException
      Creates a new transaction and associates it with the current thread.
      Throws:
      IllegalStateException - The IllegalStateException is thrown to indicate the method is invoked at a wrong time
      jakarta.transaction.SystemException - The SystemException is thrown to indicate the OTMM(MicroTx) has encountered an unexpected error condition
    • begin

      public void begin(Boolean enlist) throws IllegalStateException, jakarta.transaction.SystemException
      Throws:
      IllegalStateException
      jakarta.transaction.SystemException
    • startTCSGlobalTransaction

      public void startTCSGlobalTransaction() throws IllegalStateException, jakarta.transaction.SystemException
      Start the Golbal Transaction with the TCS
      Specified by:
      startTCSGlobalTransaction in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Throws:
      IllegalStateException - .
      jakarta.transaction.SystemException
    • commit

      public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, jakarta.transaction.SystemException
      Commit the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.
      Throws:
      jakarta.transaction.RollbackException - - Thrown to indicate that the transaction has been rolled back rather than committed based on status/exception returned by transaction coordinator.
      jakarta.transaction.HeuristicMixedException - - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back based on status/exception returned by transaction coordinator.
      jakarta.transaction.HeuristicRollbackException - - Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back based on status/exception returned by transaction coordinator.
      SecurityException - - Thrown to indicate that the thread is not allowed to commit the transaction.
      IllegalStateException - - Thrown if the current thread is not associated with a transaction.
      jakarta.transaction.SystemException - - Thrown if an unexpected error condition is encountered.
    • rollback

      public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException
      Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.
      Throws:
      SecurityException - - Thrown to indicate that the thread is not allowed to commit the transaction.
      IllegalStateException - - Thrown if the current thread is not associated with a transaction.
      jakarta.transaction.SystemException - - Thrown if an unexpected error condition is encountered.
    • suspend

      public void suspend() throws IllegalStateException
      Suspend the transaction. This affects only the local transaction state. This is intended to ensure that the client jax-rs filter for outgoing requests do not perform transaction.
      Specified by:
      suspend in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Throws:
      IllegalStateException - Thrown if the current thread is not associated with a transaction.
    • resume

      public void resume() throws IllegalStateException
      Resume the transaction. This affects only the local transaction state. This is intended to ensure that the client jax-rs filter for outgoing requests starts performing transaction specific operations again.
      Specified by:
      resume in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Throws:
      IllegalStateException - Thrown if the current thread is not associated with a transaction.
    • getTransactionID

      public String getTransactionID() throws IllegalStateException
      Get OTMM(MicroTx) user transaction ID associated with the current thread
      Overrides:
      getTransactionID in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Returns:
      returns the GTRID.
      Throws:
      IllegalStateException - Thrown if the current UserTransaction instance/object has not been used to begin a transaction
    • setRollbackOnly

      public void setRollbackOnly() throws IllegalStateException
      Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
      Specified by:
      setRollbackOnly in interface jakarta.transaction.UserTransaction
      Overrides:
      setRollbackOnly in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Throws:
      IllegalStateException - - Thrown if the current thread is not associated with a transaction.
    • getStatus

      public int getStatus() throws jakarta.transaction.SystemException
      Obtain the status of the transaction associated with the current thread.
      Returns:
      Returns transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value.
      Throws:
      jakarta.transaction.SystemException - - Thrown if an unexpected error condition is encountered.
    • setTransactionTimeout

      public void setTransactionTimeout(int timeout)
      Modify the timeout value that is associated with transactions started by the current thread with the begin method. If an application has not called this method, the transaction service uses some default value for the transaction timeout.
      Specified by:
      setTransactionTimeout in interface jakarta.transaction.UserTransaction
      Overrides:
      setTransactionTimeout in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Parameters:
      timeout - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown.
    • finalize

      protected void finalize()
      finalize make sure relevant ThreadLocal objects are removed in case of bug in application code where commit/rollback has not been called.
      Overrides:
      finalize in class Object
    • getTxnInternalUrl

      public String getTxnInternalUrl() throws IllegalStateException
      Get OTMM(MicroTx) user transaction internal URL
      Overrides:
      getTxnInternalUrl in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Returns:
      OTMM(MicroTx) user transaction internal URL
      Throws:
      IllegalStateException - The IllegalStateException is thrown to indicate the method is invoked at a wrong time
    • getTxnExternalUrl

      public String getTxnExternalUrl() throws IllegalStateException
      Get OTMM(MicroTx) user transaction external URL
      Overrides:
      getTxnExternalUrl in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Returns:
      OTMM(MicroTx) user transaction external URL
      Throws:
      IllegalStateException - The IllegalStateException is thrown to indicate the method is invoked at a wrong time
    • getTxnUrl

      public String getTxnUrl() throws IllegalStateException
      Overrides:
      getTxnUrl in class com.oracle.microtx.xa.rm.MicroTxUserTransaction
      Throws:
      IllegalStateException
    • setProperty

      public void setProperty(String propertyName, Object propertyValue)
      Overrides:
      setProperty in class com.oracle.microtx.xa.rm.MicroTxUserTransaction