Package io.quarkus.narayana.jta
Interface TransactionRunnerOptions
-
- All Superinterfaces:
TransactionRunner
- All Known Implementing Classes:
TransactionRunnerImpl
public interface TransactionRunnerOptions extends TransactionRunner
Builder interface to allow various options of a transaction runner to be customized.Note this interface extends
TransactionRunner, so it can be used to run a task directly withTransactionRunner.run(Runnable)/TransactionRunner.call(Callable), even if no options need to be customized.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TransactionRunnerOptionsexceptionHandler(Function<Throwable,TransactionExceptionResult> handler)Provides an exception handler that can make a decision to rollback or commit based on the type of exception.TransactionRunnerOptionstimeout(int seconds)Sets the transaction timeout for transactions created by this runner.-
Methods inherited from interface io.quarkus.narayana.jta.TransactionRunner
call, run
-
-
-
-
Method Detail
-
timeout
TransactionRunnerOptions timeout(int seconds)
Sets the transaction timeout for transactions created by this runner. A value of zero refers to the system default.- Parameters:
seconds- The timeout in seconds- Returns:
- This builder
- Throws:
IllegalArgumentException- If seconds is negative
-
exceptionHandler
TransactionRunnerOptions exceptionHandler(Function<Throwable,TransactionExceptionResult> handler)
Provides 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.
- Parameters:
handler- The exception handler- Returns:
- This builder
-
-