Class ContextTransactionManager

java.lang.Object
org.wildfly.transaction.client.ContextTransactionManager
All Implemented Interfaces:
jakarta.transaction.TransactionManager

public final class ContextTransactionManager extends Object implements jakarta.transaction.TransactionManager
The singleton, global transaction manager for the local instance.
Author:
David M. Lloyd
  • Method Details

    • begin

      public void begin() throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemException
      Specified by:
      begin in interface jakarta.transaction.TransactionManager
      Throws:
      jakarta.transaction.NotSupportedException
      jakarta.transaction.SystemException
    • commit

      public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      commit in interface jakarta.transaction.TransactionManager
      Throws:
      jakarta.transaction.RollbackException
      jakarta.transaction.HeuristicMixedException
      jakarta.transaction.HeuristicRollbackException
      SecurityException
      IllegalStateException
      jakarta.transaction.SystemException
    • rollback

      public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException
      Specified by:
      rollback in interface jakarta.transaction.TransactionManager
      Throws:
      IllegalStateException
      SecurityException
      jakarta.transaction.SystemException
    • setRollbackOnly

      public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      setRollbackOnly in interface jakarta.transaction.TransactionManager
      Throws:
      IllegalStateException
      jakarta.transaction.SystemException
    • getStatus

      public int getStatus() throws jakarta.transaction.SystemException
      Specified by:
      getStatus in interface jakarta.transaction.TransactionManager
      Throws:
      jakarta.transaction.SystemException
    • getTransaction

      public AbstractTransaction getTransaction()
      Specified by:
      getTransaction in interface jakarta.transaction.TransactionManager
    • setTransactionTimeout

      public void setTransactionTimeout(int timeout)
      Specified by:
      setTransactionTimeout in interface jakarta.transaction.TransactionManager
    • getTransactionTimeout

      public int getTransactionTimeout()
      Get the current effective transaction timeout, in seconds. If the current thread transaction timeout is set to zero, the global default value is returned.
      Returns:
      the effective transaction timeout (always greater than zero)
    • getConfiguredTransactionTimeout

      public int getConfiguredTransactionTimeout()
      Get the current configured transaction timeout, in seconds, or zero if the global default is in use.
      Returns:
      the effective transaction timeout, or zero if the global default is in use
    • suspend

      public AbstractTransaction suspend() throws jakarta.transaction.SystemException
      Specified by:
      suspend in interface jakarta.transaction.TransactionManager
      Throws:
      jakarta.transaction.SystemException
    • resume

      public void resume(jakarta.transaction.Transaction transaction) throws jakarta.transaction.InvalidTransactionException, IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      resume in interface jakarta.transaction.TransactionManager
      Throws:
      jakarta.transaction.InvalidTransactionException
      IllegalStateException
      jakarta.transaction.SystemException
    • getInstance

      public static ContextTransactionManager getInstance()
      Get the transaction manager instance.
      Returns:
      the transaction manager instance (not null)
    • getGlobalDefaultTransactionTimeout

      public static int getGlobalDefaultTransactionTimeout()
      Get the global default transaction timeout.
      Returns:
      the global default transaction timeout in seconds (>= 1)
    • setGlobalDefaultTransactionTimeout

      public static int setGlobalDefaultTransactionTimeout(int newTimeout)
      Set the global default transaction timeout, returning the original value.
      Parameters:
      newTimeout - the new timeout value in seconds (must be >= 1)
      Returns:
      the previous timeout in seconds (>= 1)
    • setMinimumGlobalDefaultTransactionTimeout

      public static int setMinimumGlobalDefaultTransactionTimeout(int minimumTimeout)
      Set the minimum global default transaction timeout, returning the original value. The new timeout will not be less than the given minimum.
      Parameters:
      minimumTimeout - the minimum timeout value in seconds (must be >= 1)
      Returns:
      the previous timeout in seconds (>= 1)
    • setMaximumGlobalDefaultTransactionTimeout

      public static int setMaximumGlobalDefaultTransactionTimeout(int maximumTimeout)
      Set the maximum global default transaction timeout, returning the original value. The new timeout will not be greater than the given maximum.
      Parameters:
      maximumTimeout - the maximum timeout value in seconds (must be >= 1)
      Returns:
      the previous timeout in seconds (>= 1)