Class JtaStatusHelper


  • public final class JtaStatusHelper
    extends Object
    Utility for dealing with JTA statuses.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getStatus​(jakarta.transaction.TransactionManager transactionManager)
      Extract the status code from the current Transaction associated with the given TransactionManager
      static int getStatus​(jakarta.transaction.UserTransaction userTransaction)
      Extract the status code from a UserTransaction
      static boolean isActive​(int status)
      Does the given status code indicate an active transaction?
      static boolean isActive​(jakarta.transaction.TransactionManager transactionManager)
      Does the status code obtained from the given TransactionManager indicate an active transaction?
      static boolean isActive​(jakarta.transaction.UserTransaction userTransaction)
      Does the status code obtained from the given UserTransaction indicate an active transaction?
      static boolean isCommitted​(int status)
      Does the given status code indicate a committed transaction?
      static boolean isCommitted​(jakarta.transaction.TransactionManager transactionManager)
      Does the status code obtained from the given TransactionManager indicate a commit?
      static boolean isCommitted​(jakarta.transaction.UserTransaction userTransaction)
      Does the status code obtained from the given UserTransaction indicate a commit?
      static boolean isMarkedForRollback​(int status)
      Does the given status code indicate the transaction has been marked for rollback?
      static boolean isRollback​(int status)
      Does the given status code indicate a rolled back transaction?
      static boolean isRollback​(jakarta.transaction.TransactionManager transactionManager)
      Does the status code obtained from the given TransactionManager indicate a roll back?
      static boolean isRollback​(jakarta.transaction.UserTransaction userTransaction)
      Does the status code obtained from the given UserTransaction indicate a roll back?
    • Method Detail

      • getStatus

        public static int getStatus​(jakarta.transaction.UserTransaction userTransaction)
        Extract the status code from a UserTransaction
        Parameters:
        userTransaction - The UserTransaction from which to extract the status.
        Returns:
        The transaction status
        Throws:
        TransactionException - If the UserTransaction reports the status as unknown
      • getStatus

        public static int getStatus​(jakarta.transaction.TransactionManager transactionManager)
        Extract the status code from the current Transaction associated with the given TransactionManager
        Parameters:
        transactionManager - The TransactionManager from which to extract the status.
        Returns:
        The transaction status
        Throws:
        TransactionException - If the TransactionManager reports the status as unknown
      • isActive

        public static boolean isActive​(int status)
        Does the given status code indicate an active transaction?
        Parameters:
        status - The transaction status code to check
        Returns:
        True if the code indicates active; false otherwise.
      • isActive

        public static boolean isActive​(jakarta.transaction.UserTransaction userTransaction)
        Does the status code obtained from the given UserTransaction indicate an active transaction?
        Parameters:
        userTransaction - The UserTransaction whose status is to be checked
        Returns:
        True if the transaction is active; false otherwise.
      • isActive

        public static boolean isActive​(jakarta.transaction.TransactionManager transactionManager)
        Does the status code obtained from the given TransactionManager indicate an active transaction?
        Parameters:
        transactionManager - The TransactionManager whose status is to be checked
        Returns:
        True if the transaction is active; false otherwise.
      • isRollback

        public static boolean isRollback​(int status)
        Does the given status code indicate a rolled back transaction?
        Parameters:
        status - The transaction status code to check
        Returns:
        True if the code indicates a roll back; false otherwise.
      • isRollback

        public static boolean isRollback​(jakarta.transaction.UserTransaction userTransaction)
        Does the status code obtained from the given UserTransaction indicate a roll back?
        Parameters:
        userTransaction - The UserTransaction whose status is to be checked
        Returns:
        True if the transaction indicates roll back; false otherwise.
      • isRollback

        public static boolean isRollback​(jakarta.transaction.TransactionManager transactionManager)
        Does the status code obtained from the given TransactionManager indicate a roll back?
        Parameters:
        transactionManager - The TransactionManager whose status is to be checked
        Returns:
        True if the transaction indicates roll back; false otherwise.
      • isCommitted

        public static boolean isCommitted​(int status)
        Does the given status code indicate a committed transaction?
        Parameters:
        status - The transaction status code to check
        Returns:
        True if the code indicates a roll back; false otherwise.
      • isCommitted

        public static boolean isCommitted​(jakarta.transaction.UserTransaction userTransaction)
        Does the status code obtained from the given UserTransaction indicate a commit?
        Parameters:
        userTransaction - The UserTransaction whose status is to be checked
        Returns:
        True if the transaction indicates commit; false otherwise.
      • isCommitted

        public static boolean isCommitted​(jakarta.transaction.TransactionManager transactionManager)
        Does the status code obtained from the given TransactionManager indicate a commit?
        Parameters:
        transactionManager - The TransactionManager whose status is to be checked
        Returns:
        True if the transaction indicates commit; false otherwise.
      • isMarkedForRollback

        public static boolean isMarkedForRollback​(int status)
        Does the given status code indicate the transaction has been marked for rollback?
        Parameters:
        status - The transaction status code to check
        Returns:
        True if the code indicates a roll back; false otherwise.