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
  • Constructor Details

  • Method Details

    • timeout

      public TransactionRunnerImpl timeout(int seconds)
      Description copied from interface: TransactionRunnerOptions
      Sets the transaction timeout for transactions created by this runner. A value of zero refers to the system default.
      Specified by:
      timeout in interface TransactionRunnerOptions
      Parameters:
      seconds - The timeout in seconds
      Returns:
      This builder
    • exceptionHandler

      Description copied from interface: TransactionRunnerOptions
      Provides an exception handler that can make a decision to rollback or commit based on the type of exception. If the predicate returns TransactionExceptionResult.ROLLBACK the 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:
      exceptionHandler in interface TransactionRunnerOptions
      Parameters:
      handler - The exception handler
      Returns:
      This builder
    • run

      public void run(Runnable task)
      Description copied from interface: TransactionRunner
      Runs the given runnable, starting/suspending transactions as required by the selected semantics.
      Specified by:
      run in interface TransactionRunner
      Parameters:
      task - A task to run with the selected transaction semantics.
    • call

      public <T> T call(Callable<T> task)
      Description copied from interface: TransactionRunner
      Calls the given callable, starting/suspending transactions as required by the selected semantics.

      If the task throws a checked exception it will be wrapped with a QuarkusTransactionException

      Specified by:
      call in interface TransactionRunner
      Parameters:
      task - A task to run with the selected transaction semantics.
      Returns:
      The value returned by task.call().