View Javadoc

1   package com.atlassian.vcache.internal.core;
2   
3   import com.atlassian.vcache.internal.RequestContext;
4   
5   import java.util.Set;
6   
7   /**
8    * Provides tracking of transactional resources that need to be synchronised.
9    *
10   * @since 1.0.0
11   */
12  public interface TransactionControlManager {
13      /**
14       * Register a {@link com.atlassian.vcache.TransactionalExternalCache} for synchronisation.
15       *
16       * @param requestContext the context for tracking
17       * @param cacheName      the name of cache to be registered
18       * @param control        the control used to synchronise the cache.
19       */
20      void registerTransactionalExternalCache(RequestContext requestContext, String cacheName, TransactionControl control);
21  
22      /**
23       * Synchronises all the resources previously registered using {@link #registerTransactionalExternalCache(RequestContext, String, TransactionControl)}.
24       *
25       * @param requestContext the context used for tracking
26       */
27      void syncAll(RequestContext requestContext);
28  
29      /**
30       * Discards all the resources previously registered using {@link #registerTransactionalExternalCache(RequestContext, String, TransactionControl)}.
31       *
32       * @param requestContext the context used for tracking
33       * @return names of the caches that have operations being discarded.
34       */
35      Set<String> discardAll(RequestContext requestContext);
36  }