Package io.quarkus.narayana.jta
Class TransactionRunnerImpl
java.lang.Object
io.quarkus.narayana.jta.RunOptionsBase
io.quarkus.narayana.jta.TransactionRunnerImpl
- All Implemented Interfaces:
TransactionRunner,TransactionRunnerOptions
class TransactionRunnerImpl
extends RunOptionsBase
implements TransactionRunnerOptions, TransactionRunner
-
Field Summary
Fields inherited from class io.quarkus.narayana.jta.RunOptionsBase
exceptionHandler, semantics, timeout -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TCalls the given callable, starting/suspending transactions as required by the selectedsemantics.Provides an exception handler that can make a decision to rollback or commit based on the type of exception.voidRuns the given runnable, starting/suspending transactions as required by the selectedsemantics.timeout(int seconds) Sets the transaction timeout for transactions created by this runner.Methods inherited from class io.quarkus.narayana.jta.RunOptionsBase
setExceptionHandler, setSemantics, setTimeout
-
Constructor Details
-
TransactionRunnerImpl
TransactionRunnerImpl(TransactionSemantics semantics)
-
-
Method Details
-
timeout
Description copied from interface:TransactionRunnerOptionsSets the transaction timeout for transactions created by this runner. A value of zero refers to the system default.- Specified by:
timeoutin interfaceTransactionRunnerOptions- Parameters:
seconds- The timeout in seconds- Returns:
- This builder
-
exceptionHandler
public TransactionRunnerImpl exceptionHandler(Function<Throwable, TransactionExceptionResult> handler) Description copied from interface:TransactionRunnerOptionsProvides an exception handler that can make a decision to rollback or commit based on the type of exception. If the predicate returnsTransactionExceptionResult.ROLLBACKthe transaction is rolled back, otherwise it is committed.This exception will still be propagated to the caller, so this method should not log or perform any other actions other than determine what should happen to the current transaction.
By default, the exception is always rolled back.
- Specified by:
exceptionHandlerin interfaceTransactionRunnerOptions- Parameters:
handler- The exception handler- Returns:
- This builder
-
run
Description copied from interface:TransactionRunnerRuns the given runnable, starting/suspending transactions as required by the selectedsemantics.- Specified by:
runin interfaceTransactionRunner- Parameters:
task- A task to run with the selected transaction semantics.
-
call
Description copied from interface:TransactionRunnerCalls the given callable, starting/suspending transactions as required by the selectedsemantics.If the task throws a checked exception it will be wrapped with a
QuarkusTransactionException- Specified by:
callin interfaceTransactionRunner- Parameters:
task- A task to run with the selected transaction semantics.- Returns:
- The value returned by
task.call().
-