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 long |
getSeedFromTime(long timeMs,
long runIntervalMs) |
protected long |
getSyncClusterTime() |
protected void |
handlePanic() |
protected void |
logRuntimeInfo() |
protected void |
onCacheNumberIsMissed(@NonNull Integer dbSafetyNumber,
int nextValue)
Method is called when safety number is missed in cache.
|
protected void |
onDatabaseNumberIsMissed(@NonNull String lastCacheModifier,
@NonNull Integer cacheSafetyNumber,
int nextValue)
Method is called when safety number is missed in database.
|
protected void |
onNumbersAreDifferent(@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 void |
onNumbersAreEqual(@NonNull String lastCacheModifier,
@NonNull Integer dbSafetyNumber,
@NonNull 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.
|
protected boolean |
shouldRun(List<String> members,
String thisNode,
long runIntervalMs)
This job is created with "runOncePerCluster=false".
|
void |
verify(long runIntervalMs)
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(long runIntervalMs)
ClusterSafetyManager
verify
in interface ClusterSafetyManager
verify
in class AbstractClusterSafetyManager
protected boolean shouldRun(List<String> members, String thisNode, long runIntervalMs)
In other words, this is like "runOncePerCluster=true", but with guarantee that eventually the task will be run on each node.
protected long getSyncClusterTime()
protected long getSeedFromTime(long timeMs, long runIntervalMs)
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–2020 Atlassian. All rights reserved.