Class CronResourceSynchronizer<R extends CronResource<R,N>,N extends CronResourceNode<R,N>>
To support masters synchronizing while slaves only test, if a test and a synchronization are scheduled at the same moment, the synchronization is performed if possible, and the test is only performed if the synchronization is not possible. Thus, a synchronization also counts as a test and should perform at least as thorough of a check as a test would perform.
If a synchronization or test is missed, no catch-up is performed. This is true for both when the node is down or when a previous test/synchronization took too long, overlapping the current schedule.
- Author:
- AO Industries, Inc.
-
Field Summary
Fields inherited from class com.aoapps.appcluster.ResourceSynchronizer
localResourceNode, remoteResourceNode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCronResourceSynchronizer(N localResourceNode, N remoteResourceNode, Schedule synchronizeSchedule, Schedule testSchedule) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleancanSynchronize(ResourceSynchronizationMode mode, ResourceNodeDnsResult localDnsResult, ResourceNodeDnsResult remoteDnsResult) Checks if a resource may be synchronized given the current DNS state of the nodes.booleanDetermines if the synchronizer can run now.booleanConvenience method for JavaBeans property.booleanConvenience method for JavaBeans property.Gets the last synchronization result ornullif unavailable.getState()Gets the current synchronization state.Gets a description of the current state ornullfor no specific message.Gets the synchronize schedule.Gets the test schedule.protected voidstart()Starts the synchronizer.protected voidstop()Stops the synchronizer.protected abstract ResourceSynchronizationResultsynchronize(ResourceSynchronizationMode mode, ResourceNodeDnsResult localDnsResult, ResourceNodeDnsResult remoteDnsResult) Synchronizes (or tests) the resource.voidSchedules an immediate synchronization if the resource is enabled and sleeping.Methods inherited from class com.aoapps.appcluster.ResourceSynchronizer
getLocalResourceNode, getRemoteResourceNode, getResultStatus, toString
-
Constructor Details
-
CronResourceSynchronizer
-
-
Method Details
-
getSynchronizeSchedule
Gets the synchronize schedule. -
canSynchronizeNow
Determines if the synchronizer can run now. -
getCanSynchronizeNow
public boolean getCanSynchronizeNow()Convenience method for JavaBeans property.- See Also:
-
getCanTestNow
public boolean getCanTestNow()Convenience method for JavaBeans property.- See Also:
-
synchronizeNow
Schedules an immediate synchronization if the resource is enabled and sleeping.- Specified by:
synchronizeNowin classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
getTestSchedule
Gets the test schedule. -
getState
Description copied from class:ResourceSynchronizerGets the current synchronization state.- Specified by:
getStatein classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
getStateMessage
Description copied from class:ResourceSynchronizerGets a description of the current state ornullfor no specific message.- Specified by:
getStateMessagein classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
getLastResult
Description copied from class:ResourceSynchronizerGets the last synchronization result ornullif unavailable.- Specified by:
getLastResultin classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
start
protected void start()Description copied from class:ResourceSynchronizerStarts the synchronizer.- Specified by:
startin classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
stop
protected void stop()Description copied from class:ResourceSynchronizerStops the synchronizer.- Specified by:
stopin classResourceSynchronizer<R extends CronResource<R,N>, N extends CronResourceNode<R, N>>
-
canSynchronize
protected abstract boolean canSynchronize(ResourceSynchronizationMode mode, ResourceNodeDnsResult localDnsResult, ResourceNodeDnsResult remoteDnsResult) Checks if a resource may be synchronized given the current DNS state of the nodes. -
synchronize
protected abstract ResourceSynchronizationResult synchronize(ResourceSynchronizationMode mode, ResourceNodeDnsResult localDnsResult, ResourceNodeDnsResult remoteDnsResult) Synchronizes (or tests) the resource.
-
