View Javadoc
1   package com.atlassian.sal.api.rdbms;
2   
3   import com.atlassian.annotations.PublicApi;
4   
5   /**
6    * Provided by the host application for creating {@link com.atlassian.sal.api.rdbms.TransactionalExecutor}.
7    * <p>
8    * Note that the TransactionalExecutors created are not considered thread safe.
9    *
10   * @since 3.0
11   */
12  @PublicApi
13  public interface TransactionalExecutorFactory {
14  
15      /**
16       * Create a transactional executor with <code>readOnly</code> not set and <code>requiresNew</code> not set
17       */
18      default TransactionalExecutor create() {
19          return createExecutor(false, false);
20      }
21  
22      /**
23       * Create a transactional executor with <code>readOnly</code> set and <code>requiresNew</code> not set
24       */
25      default TransactionalExecutor createReadOnly() {
26          return createExecutor(true, false);
27      }
28  
29      /**
30       * Create a transactional executor
31       *
32       * @param readOnly    initial value for <code>readOnly</code>
33       * @param requiresNew initial value for <code>requiresNew</code>
34       */
35      default TransactionalExecutor createExecutor(boolean readOnly, boolean requiresNew) {
36          throw new UnsupportedOperationException("not implemented by default");
37      }
38  
39      /**
40       * @deprecated As of release 3.1.0, replaced by {@link #createReadOnly()}
41       * Create a transactional executor with <code>readOnly</code> set and <code>requiresNew</code> not set
42       */
43      @Deprecated
44      default TransactionalExecutor createExecutor() {
45          return createExecutor(true, false);
46      }
47  }