Class TransactionalExecutor

java.lang.Object
com.polarion.alm.shared.api.transaction.TransactionalExecutor

public final class TransactionalExecutor extends Object
Executor for code using the ReadOnlyTransaction or WriteTransaction
Since:
3.9.0
  • Method Details

    • currentTransaction

      @Nullable public static <T extends ReadOnlyTransaction> T currentTransaction()
      Returns current transaction.
    • executeInReadOnlyTransaction

      @Nullable public static <T> T executeInReadOnlyTransaction(@NotNull RunnableInReadOnlyTransaction<T> runnable)
      Executes the runnable in read only transaction.
      Throws:
      IllegalStateException - when there is already a transaction
    • executeSafelyInReadOnlyTransaction

      @Nullable public static <T> T executeSafelyInReadOnlyTransaction(@NotNull RunnableInReadOnlyTransaction<T> runnable)
      Executes the runnable in read only transaction. Will reuse existing transaction if there is one.
      Since:
      3.10.0
    • executeInWriteTransaction

      @Nullable public static <T> T executeInWriteTransaction(@NotNull RunnableInWriteTransaction<T> runnable)
      Executes the runnable in write transaction, should be used only when some writing is needed.
      Throws:
      IllegalStateException - when there is already a transaction