Enum Class RunOptions.Semantic
- All Implemented Interfaces:
Serializable,Comparable<RunOptions.Semantic>,Constable
- Enclosing class:
- RunOptions
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIf a transaction is already associated with the current thread aQuarkusTransactionExceptionwill be thrown, otherwise a new transaction is started, and follows all the normal lifecycle rules.If no transaction is active then a new transaction will be started, and committed when the method ends.This is the default semantic.If no transaction is active then this semantic is basically a no-op. -
Method Summary
Modifier and TypeMethodDescriptionstatic RunOptions.SemanticReturns the enum constant of this class with the specified name.static RunOptions.Semantic[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DISALLOW_EXISTING
If a transaction is already associated with the current thread aQuarkusTransactionExceptionwill be thrown, otherwise a new transaction is started, and follows all the normal lifecycle rules. -
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.ROLLBACKwill result in the TX marked as rollback only, while a result ofRunOptions.ExceptionResult.COMMITwill result in no action being taken. -
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
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
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
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 nameNullPointerException- if the argument is null
-