public class HazelcastClusterSafetyManager extends AbstractClusterSafetyManager
Modifier and Type | Field and Description |
---|---|
static String |
SAFETY_MAP_PREFIX |
NON_CLUSTERED_NODE_NAME, NOT_FOUND_STATEMENT, random, SAFETY_NUMBER, SAFETY_NUMBER_MODIFIER
Constructor and Description |
---|
HazelcastClusterSafetyManager(ClusterSafetyDao clusterSafetyDao,
com.atlassian.event.api.EventPublisher eventPublisher,
ClusterManager clusterManager,
com.atlassian.util.concurrent.Supplier<com.hazelcast.core.HazelcastInstance> instanceSupplier,
ActivityMonitor activityMonitor,
ScheduledExecutorService executor,
LicenseService licenseService) |
Modifier and Type | Method and Description |
---|---|
protected int |
decodeClusterSize(int dbSafetyNumber) |
protected int |
encodeClusterSize(int nextValue) |
protected org.slf4j.Logger |
getLogger() |
protected int |
getNextValue() |
protected com.hazelcast.core.IMap<String,Integer> |
getSafetyNumberMap() |
protected com.hazelcast.core.IMap<String,String> |
getSafetyNumberModifierMap() |
protected void |
handlePanic() |
protected void |
logRuntimeInfo() |
protected void |
onCacheNumberIsMissed(Integer dbSafetyNumber,
int nextValue)
Method is called when safety number is missed in cache.
|
protected void |
onDatabaseNumberIsMissed(String lastCacheModifier,
Integer cacheSafetyNumber,
int nextValue)
Method is called when safety number is missed in database.
|
protected void |
onNumbersAreDifferent(String lastCacheModifier,
Integer dbSafetyNumber,
Integer cacheSafetyNumber,
int nextValue)
Method is called when safety numbers in cache and database are not equal.
|
protected void |
onNumbersAreEqual(String lastCacheModifier,
Integer dbSafetyNumber,
Integer cacheSafetyNumber,
int nextValue)
Method is called when safety numbers in cache and database are equal.
|
protected void |
onNumbersMissed(int nextValue)
Method is called when safety numbers in cache and database are missed.
|
void |
verify()
Ensures cluster is safe.
|
getClusterManager, getEventPublisher, getLicenseService, getNodeName, isLogEnabled, updateSafetyNumber
public static final String SAFETY_MAP_PREFIX
public HazelcastClusterSafetyManager(ClusterSafetyDao clusterSafetyDao, com.atlassian.event.api.EventPublisher eventPublisher, ClusterManager clusterManager, com.atlassian.util.concurrent.Supplier<com.hazelcast.core.HazelcastInstance> instanceSupplier, ActivityMonitor activityMonitor, ScheduledExecutorService executor, LicenseService licenseService)
public void verify()
ClusterSafetyManager
verify
in interface ClusterSafetyManager
verify
in class AbstractClusterSafetyManager
protected void onDatabaseNumberIsMissed(@Nonnull String lastCacheModifier, @Nonnull Integer cacheSafetyNumber, int nextValue)
AbstractClusterSafetyManager
onDatabaseNumberIsMissed
in class AbstractClusterSafetyManager
lastCacheModifier
- last cache modifiercacheSafetyNumber
- safety number in cachenextValue
- next safety number to put into the cache and databaseprotected void onCacheNumberIsMissed(@Nonnull Integer dbSafetyNumber, int nextValue)
AbstractClusterSafetyManager
onCacheNumberIsMissed
in class AbstractClusterSafetyManager
dbSafetyNumber
- safety number in databasenextValue
- next safety number to put into the cache and databaseprotected void onNumbersAreDifferent(@Nonnull String lastCacheModifier, @Nonnull Integer dbSafetyNumber, @Nonnull Integer cacheSafetyNumber, int nextValue) throws ClusterPanicException
AbstractClusterSafetyManager
ClusterPanicException
to trigger cluster panic.onNumbersAreDifferent
in class AbstractClusterSafetyManager
lastCacheModifier
- last cache modifierdbSafetyNumber
- safety number in databasecacheSafetyNumber
- safety number in cachenextValue
- next safety number to put into the cache and databaseClusterPanicException
- in a case if panic should be triggeredprotected void onNumbersAreEqual(@Nonnull String lastCacheModifier, @Nonnull Integer dbSafetyNumber, @Nonnull Integer cacheSafetyNumber, int nextValue)
AbstractClusterSafetyManager
onNumbersAreEqual
in class AbstractClusterSafetyManager
lastCacheModifier
- last cache modifierdbSafetyNumber
- safety number in databasecacheSafetyNumber
- safety number in cachenextValue
- next safety number to put into the cache and databaseprotected void onNumbersMissed(int nextValue)
AbstractClusterSafetyManager
onNumbersMissed
in class AbstractClusterSafetyManager
nextValue
- next safety number to put into the cache and databaseprotected void handlePanic()
handlePanic
in class AbstractClusterSafetyManager
protected void logRuntimeInfo()
logRuntimeInfo
in class AbstractClusterSafetyManager
protected org.slf4j.Logger getLogger()
getLogger
in class AbstractClusterSafetyManager
protected com.hazelcast.core.IMap<String,Integer> getSafetyNumberMap()
getSafetyNumberMap
in class AbstractClusterSafetyManager
protected com.hazelcast.core.IMap<String,String> getSafetyNumberModifierMap()
getSafetyNumberModifierMap
in class AbstractClusterSafetyManager
protected int getNextValue()
getNextValue
in class AbstractClusterSafetyManager
protected int encodeClusterSize(int nextValue)
protected int decodeClusterSize(int dbSafetyNumber)
Copyright © 2003–2016 Atlassian. All rights reserved.