Enum Class RunOptions.Semantic

java.lang.Object
java.lang.Enum<RunOptions.Semantic>
io.quarkus.narayana.jta.RunOptions.Semantic
All Implemented Interfaces:
Serializable, Comparable<RunOptions.Semantic>, Constable
Enclosing class:
RunOptions

public static enum RunOptions.Semantic extends Enum<RunOptions.Semantic>
Enum that can be used to control the transaction behaviour in the presence or absence of an existing transaction.
  • Enum Constant Details

    • DISALLOW_EXISTING

      public static final RunOptions.Semantic DISALLOW_EXISTING
      If a transaction is already associated with the current thread a QuarkusTransactionException will be thrown, otherwise a new transaction is started, and follows all the normal lifecycle rules.
    • JOIN_EXISTING

      public static final RunOptions.Semantic JOIN_EXISTING

      If no transaction is active then a new transaction will be started, and committed when the method ends. If an exception is thrown the exception handler registered by RunOptions.exceptionHandler(Function) will be called to decide if the TX should be committed or rolled back.

      If an existing transaction is active then the method is run in the context of the existing transaction. If an exception is thrown the exception handler will be called, however a result of RunOptions.ExceptionResult.ROLLBACK will result in the TX marked as rollback only, while a result of RunOptions.ExceptionResult.COMMIT will result in no action being taken.

    • REQUIRE_NEW

      public static final RunOptions.Semantic REQUIRE_NEW
      This is the default semantic.

      If an existing transaction is already associated with the current thread then the transaction is suspended, and resumed once the current transaction is complete.

      A new transaction is started after the existing transaction is suspended, and follows all the normal lifecycle rules.

    • SUSPEND_EXISTING

      public static final RunOptions.Semantic SUSPEND_EXISTING
      If no transaction is active then this semantic is basically a no-op.

      If a transaction is active then it is suspended, and resumed after the task is run.

      The exception handler will never be consulted when this semantic is in use, specifying both an exception handler and this semantic is considered an error.

      This semantic allows for code to easily be run outside the scope of a transaction.

  • Method Details

    • values

      public static RunOptions.Semantic[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RunOptions.Semantic valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null