Class TransactionExecutor
- java.lang.Object
-
- com.atlassian.connect.spring.internal.lifecycle.TransactionExecutor
-
@Service public class TransactionExecutor extends Object
A utility that executes transactions with optional rollback.
-
-
Constructor Summary
Constructors Constructor Description TransactionExecutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> org.springframework.util.concurrent.ListenableFuture<T>
executeWithRollbackOption(Supplier<T> supplier, AtomicBoolean shouldRollback)
Executes the given supplier in a transaction, allowing the caller to trigger rollback before its completion by setting the provided flag.
-
-
-
Method Detail
-
executeWithRollbackOption
@Async public <T> org.springframework.util.concurrent.ListenableFuture<T> executeWithRollbackOption(Supplier<T> supplier, AtomicBoolean shouldRollback)
Executes the given supplier in a transaction, allowing the caller to trigger rollback before its completion by setting the provided flag.- Type Parameters:
T
- the return type of the function- Parameters:
supplier
- the function to executeshouldRollback
- a flag indicating whether the transaction should be rolled back once the function has been executed- Returns:
- the value returned by the supplier
-
-