View Javadoc

1   package com.atlassian.sal.api.transaction;
2   
3   /**
4    * This allows applications greater control over the transaction in which operations may be executed.
5    * This really mimicks {@link org.springframework.transaction.support.TransactionTemplate}, however
6    * since JIRA doesn't know about Spring and doesn't support transactions we need to have our own implementation
7    * of this interface here.
8    *
9    * @since 2.0
10   */
11  public interface TransactionTemplate
12  {
13      /**
14       * Executes the callback, returning the object returned.  Any runtime exceptions thrown by the callback are assumed
15       * to rollback the transaction.
16       *
17       * @param action The callback
18       * @return The object returned from the callback
19       */
20      <T> T execute(TransactionCallback<T> action);
21  }