Class AbstractClusterSafetyManager
java.lang.Object
com.atlassian.confluence.cluster.safety.AbstractClusterSafetyManager
- All Implemented Interfaces:
- ClusterSafetyManager
- Direct Known Subclasses:
- DefaultClusterSafetyManager,- HazelcastClusterSafetyManager
Contains common functionality for clustered and standalone safety managers
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractClusterSafetyManager(ClusterSafetyDao clusterSafetyDao, com.atlassian.event.api.EventPublisher eventPublisher, ClusterManager clusterManager, LicenseService licenseService) 
- 
Method SummaryModifier and TypeMethodDescriptioncom.atlassian.event.api.EventPublisherprotected abstract org.slf4j.Loggerprotected intprotected @NonNull Stringprotected abstract voidbooleanprotected abstract voidprotected voidonCacheNumberIsMissed(@NonNull Integer dbSafetyNumber, int nextValue) Method is called when safety number is missed in cache.protected voidonDatabaseNumberIsMissed(@NonNull String lastCacheModifier, @NonNull Integer cacheSafetyNumber, int nextValue) Method is called when safety number is missed in database.protected voidonNumbersAreDifferent(@NonNull String lastCacheModifier, @NonNull Integer dbSafetyNumber, @NonNull Integer cacheSafetyNumber, int nextValue) Method is called when safety numbers in cache and database are not equal.protected voidonNumbersAreEqual(@NonNull String lastCacheModifier, @NonNull Integer dbSafetyNumber, @NonNull Integer cacheSafetyNumber, int nextValue) Method is called when safety numbers in cache and database are equal.protected voidonNumbersMissed(int nextValue) Method is called when safety numbers in cache and database are missed.protected voidupdateSafetyNumber(int nextValue) Updates safety number in cache and databasevoidverify(long runInterval) Ensures cluster is safe.
- 
Field Details- 
NOT_FOUND_STATEMENT- See Also:
 
- 
NON_CLUSTERED_NODE_NAME- See Also:
 
- 
SAFETY_NUMBER_MODIFIER- See Also:
 
- 
SAFETY_NUMBER- See Also:
 
- 
random
 
- 
- 
Constructor Details- 
AbstractClusterSafetyManagerprotected AbstractClusterSafetyManager(ClusterSafetyDao clusterSafetyDao, com.atlassian.event.api.EventPublisher eventPublisher, ClusterManager clusterManager, LicenseService licenseService) 
 
- 
- 
Method Details- 
verifypublic void verify(long runInterval) Description copied from interface:ClusterSafetyManagerEnsures cluster is safe. If not, panic procedure is initiated.- Specified by:
- verifyin interface- ClusterSafetyManager
 
- 
onDatabaseNumberIsMissedprotected void onDatabaseNumberIsMissed(@NonNull String lastCacheModifier, @NonNull Integer cacheSafetyNumber, int nextValue) throws ClusterPanicException Method is called when safety number is missed in database. By default it updates safety number in the cache and database.- Parameters:
- lastCacheModifier- last cache modifier
- cacheSafetyNumber- safety number in cache
- nextValue- next safety number to put into the cache and database
- Throws:
- ClusterPanicException- in a case if panic should be triggered
 
- 
onCacheNumberIsMissedprotected void onCacheNumberIsMissed(@NonNull Integer dbSafetyNumber, int nextValue) throws ClusterPanicException Method is called when safety number is missed in cache. By default it updates safety number in the cache and database.- Parameters:
- dbSafetyNumber- safety number in database
- nextValue- next safety number to put into the cache and database
- Throws:
- ClusterPanicException- in a case if panic should be triggered
 
- 
onNumbersAreEqualprotected void onNumbersAreEqual(@NonNull String lastCacheModifier, @NonNull Integer dbSafetyNumber, @NonNull Integer cacheSafetyNumber, int nextValue) throws ClusterPanicException Method is called when safety numbers in cache and database are equal. By default it updates safety number in the cache and database.- Parameters:
- lastCacheModifier- last cache modifier
- dbSafetyNumber- safety number in database
- cacheSafetyNumber- safety number in cache
- nextValue- next safety number to put into the cache and database
- Throws:
- ClusterPanicException- in a case if panic should be triggered
 
- 
onNumbersAreDifferentprotected void onNumbersAreDifferent(@NonNull String lastCacheModifier, @NonNull Integer dbSafetyNumber, @NonNull Integer cacheSafetyNumber, int nextValue) throws ClusterPanicException Method is called when safety numbers in cache and database are not equal. By default this method throwsClusterPanicExceptionto trigger cluster panic.- Parameters:
- lastCacheModifier- last cache modifier
- dbSafetyNumber- safety number in database
- cacheSafetyNumber- safety number in cache
- nextValue- next safety number to put into the cache and database
- Throws:
- ClusterPanicException- in a case if panic should be triggered
 
- 
onNumbersMissedprotected void onNumbersMissed(int nextValue) Method is called when safety numbers in cache and database are missed. By default it updates safety number in the cache and database.- Parameters:
- nextValue- next safety number to put into the cache and database
- Throws:
- ClusterPanicException- in a case if panic should be triggered
 
- 
updateSafetyNumberprotected void updateSafetyNumber(int nextValue) Updates safety number in cache and database- Parameters:
- nextValue- safety number to be updated in cache and db
 
- 
getNodeName
- 
isLogEnabledpublic boolean isLogEnabled()
- 
getNextValueprotected int getNextValue()
- 
getLoggerprotected abstract org.slf4j.Logger getLogger()
- 
logRuntimeInfoprotected abstract void logRuntimeInfo()
- 
getSafetyNumberModifierMap
- 
getSafetyNumberMap
- 
handlePanicprotected abstract void handlePanic()
- 
getEventPublisherpublic com.atlassian.event.api.EventPublisher getEventPublisher()
- 
getLicenseService
 
-