Interface SyncInstance


@PublicApi public interface SyncInstance

SyncInstance represents an instance of a synchronizer, configured with user-specified parameters to act on some structure under some user account. It may be either installed on that structure or represent a one-time synchronization action. It can represent an instance of a synchronizer that is not currently available, e.g., when the module which defines it is not loaded; then and only then getSynchronizer() returns null.

The synchronizer receives SyncInstance parameter whenever it is asked to do an instance-specific task such as syncing.

Author:
Igor Sereda
  • Method Details

    • getId

      long getId()
      Returns the ID of this synchronizer instance. It is 0 iff this sync instance represents a one-time resync.
    • getSynchronizer

      @Nullable StructureSynchronizer getSynchronizer()
      Returns the synchronizer for this sync instance. null means that the synchronizer is currently unavailable (the module that defines it is not loaded).
    • getSynchronizerModuleKey

      @NotNull String getSynchronizerModuleKey()
      Returns module key of the synchronizer for this sync instance. Always non-null, even if the synchronizer is currently unavailable.
    • getStructureId

      long getStructureId()
      Returns the ID of the structure this sync instance is acting on.
    • getParameters

      @Nullable Object getParameters()
      Returns:
      the parameters of the synchronization
    • getUserKey

      @NotNull String getUserKey()
      Returns user key of the user account that is used to run synchronizer jobs with this sync instance.
    • transientData

      @NotNull <T> AtomicReference<T> transientData(String key)

      Provides the synchronizer with a temporary / cache storage.

      The key parameter is an arbitrary string that the synchronizer can use to have storage for several types of the information. The values are stored for this sync instance only.

      Note: in JIRA Data Center, the cache is local to the current node; changes to the cached data on one node are not visible by other nodes.

      Also note that the cache lifetime is shorter than the lifetime of this SyncInstance: it may be cleared, for example, when someone modifies the parameters of this instance. Cache may also be cleared in other circumstances, like when there are many synchronizer instances in the system.

      Type Parameters:
      T - type of data stored
      Parameters:
      key - data key
      Returns:
      the container for the stored data