Class ResourceSynchronizer<R extends Resource<R,N>,N extends ResourceNode<R,N>>

java.lang.Object
com.aoapps.appcluster.ResourceSynchronizer<R,N>
Direct Known Subclasses:
CronResourceSynchronizer

public abstract class ResourceSynchronizer<R extends Resource<R,N>,N extends ResourceNode<R,N>> extends Object

Each resource has one synchronizer between it and any other node for the resource.

Every resource type should support testing. The test should ensure point-in-time consistency between two nodes as much as possible.

Resources are only required to support synchronization when is a master. They may optionally support synchronization when a slave (such as a csync2 master on a slave node).

Author:
AO Industries, Inc.
  • Field Details

    • localResourceNode

      protected final N extends ResourceNode<R,N> localResourceNode
    • remoteResourceNode

      protected final N extends ResourceNode<R,N> remoteResourceNode
  • Constructor Details

    • ResourceSynchronizer

      protected ResourceSynchronizer(N localResourceNode, N remoteResourceNode)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLocalResourceNode

      public N getLocalResourceNode()
      Gets the local resource node.
    • getRemoteResourceNode

      public N getRemoteResourceNode()
      Gets the remote resource node.
    • getState

      public abstract ResourceSynchronizerState getState()
      Gets the current synchronization state.
    • getStateMessage

      public abstract String getStateMessage()
      Gets a description of the current state or null for no specific message.
    • synchronizeNow

      public abstract void synchronizeNow(ResourceSynchronizationMode mode)
      Schedules an immediate synchronization if possible.
    • getLastResult

      public abstract ResourceSynchronizationResult getLastResult()
      Gets the last synchronization result or null if unavailable.
    • getResultStatus

      public ResourceStatus getResultStatus()
      Gets the synchronization result status. Considered as STOPPED/DISABLED/STARTING if last result is not available.
    • start

      protected abstract void start()
      Starts the synchronizer.
    • stop

      protected abstract void stop()
      Stops the synchronizer.