All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pro.taskana.common.internal.transaction.TaskanaTransactionProvider Maven / Gradle / Ivy

package pro.taskana.common.internal.transaction;

import java.util.function.Supplier;

/** This functional interface provides support for transactions. */
@FunctionalInterface
public interface TaskanaTransactionProvider {

   T executeInTransaction(Supplier supplier);

  static  T executeInTransactionIfPossible(
      TaskanaTransactionProvider transactionProvider, Supplier supplier) {
    return transactionProvider != null
        ? transactionProvider.executeInTransaction(supplier)
        : supplier.get();
  }

  static void executeInTransactionIfPossible(
      TaskanaTransactionProvider transactionProvider, Runnable runnable) {
    executeInTransactionIfPossible(
        transactionProvider,
        () -> {
          runnable.run();
          return null;
        });
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy