Module com.aoapps.appcluster.core
Package com.aoapps.appcluster
Class ResourceSynchronizer<R extends Resource<R,RN>,RN extends ResourceNode<R,RN>>
- java.lang.Object
-
- com.aoapps.appcluster.ResourceSynchronizer<R,RN>
-
- Direct Known Subclasses:
CronResourceSynchronizer
public abstract class ResourceSynchronizer<R extends Resource<R,RN>,RN extends ResourceNode<R,RN>> 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 Summary
Fields Modifier and Type Field Description protected RNlocalResourceNodeprotected RNremoteResourceNode
-
Constructor Summary
Constructors Modifier Constructor Description protectedResourceSynchronizer(RN localResourceNode, RN remoteResourceNode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ResourceSynchronizationResultgetLastResult()Gets the last synchronization result ornullif unavailable.RNgetLocalResourceNode()Gets the local resource node.RNgetRemoteResourceNode()Gets the remote resource node.ResourceStatusgetResultStatus()Gets the synchronization result status.abstract ResourceSynchronizerStategetState()Gets the current synchronization state.abstract StringgetStateMessage()Gets a description of the current state ornullfor no specific message.protected abstract voidstart()Starts the synchronizer.protected abstract voidstop()Stops the synchronizer.abstract voidsynchronizeNow(ResourceSynchronizationMode mode)Schedules an immediate synchronization if possible.StringtoString()
-
-
-
Field Detail
-
localResourceNode
protected final RN extends ResourceNode<R,RN> localResourceNode
-
remoteResourceNode
protected final RN extends ResourceNode<R,RN> remoteResourceNode
-
-
Method Detail
-
getLocalResourceNode
public RN getLocalResourceNode()
Gets the local resource node.
-
getRemoteResourceNode
public RN 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 ornullfor 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 ornullif 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.
-
-