java.lang.Object
io.helidon.transaction.Tx

public final class Tx extends Object
Annotations and types related to transactional method execution.
  • Method Details

    • transaction

      public static <T> T transaction(Callable<T> task)
      Execute provided task with managed transaction of Tx.Type.REQUIRED type. Task computes and returns result according to Callable contract.
      Type Parameters:
      T - the result type of the task
      Parameters:
      task - task to run in transaction, shall not be null
      Returns:
      computed task result
      Throws:
      TxException - when result computation failed
    • transaction

      public static <T> T transaction(Tx.Type type, Callable<T> task)
      Execute provided task with managed transaction of provided type. Task computes and returns result according to Callable contract.
      Type Parameters:
      T - the result type of the task
      Parameters:
      type - transaction type, shall not be null
      task - task to run in transaction, shall not be null
      Returns:
      computed task result
      Throws:
      TxException - when result computation failed
    • transaction

      public static void transaction(Functions.CheckedRunnable<Exception> task)
      Execute provided task with managed transaction of Tx.Type.REQUIRED type. Task does not return any result according to Functions.CheckedRunnable contract.
      Parameters:
      task - task to run in transaction, shall not be null
      Throws:
      TxException - when task computation failed
    • transaction

      public static void transaction(Tx.Type type, Functions.CheckedRunnable<Exception> task)
      Execute provided task with managed transaction of provided type. Task does not return any result according to Functions.CheckedRunnable contract.
      Parameters:
      type - transaction type, shall not be null
      task - task to run in transaction, shall not be null
      Throws:
      TxException - when task computation failed