1 package com.atlassian.sal.api.transaction;
2
3 /**
4 * A simple callback that needs to be provided with an action to run in the doInTransaction method.
5 * It is assumed that if anything goes wrong, doInTransaction will throw a RuntimeException if anything goes
6 * wrong, and the calling transactionTemplate will roll back the transaction.
7 *
8 * @since 2.0
9 */
10 public interface TransactionCallback<T> {
11 /**
12 * Runs an action in a transaction and returns a optional value.
13 *
14 * @return Optional result of the operation. May be null
15 * @throws RuntimeException if anything went wrong. The caller will be responsible for rolling back.
16 */
17 T doInTransaction();
18 }