public class ClusterCacheStatus extends Object implements AvailabilityStrategyContext
| Modifier and Type | Field and Description |
|---|---|
static int |
INITIAL_REBALANCE_ID |
static int |
INITIAL_TOPOLOGY_ID |
| Constructor and Description |
|---|
ClusterCacheStatus(EmbeddedCacheManager cacheManager,
String cacheName,
AvailabilityStrategy availabilityStrategy,
RebalanceType rebalanceType,
ClusterTopologyManagerImpl clusterTopologyManager,
Transport transport,
PersistentUUIDManager persistentUUIDManager,
EventLogManager eventLogManager,
Optional<ScopedPersistentState> state,
boolean resolveConflictsOnMerge) |
| Modifier and Type | Method and Description |
|---|---|
ConsistentHash |
calculateConflictHash(ConsistentHash preferredHash,
Set<ConsistentHash> distinctHashes,
List<Address> actualMembers) |
void |
confirmRebalancePhase(Address member,
int receivedTopologyId) |
protected CacheTopology |
createInitialCacheTopology() |
void |
doHandleClusterView(int viewId) |
CacheStatusResponse |
doJoin(Address joiner,
CacheJoinInfo joinInfo) |
CompletionStage<Void> |
doLeave(Address leaver) |
void |
doMergePartitions(Map<Address,CacheStatusResponse> statusResponses) |
CompletionStage<Void> |
forceAvailabilityMode(AvailabilityMode newAvailabilityMode) |
void |
forceRebalance() |
AvailabilityMode |
getAvailabilityMode() |
String |
getCacheName() |
Map<Address,Float> |
getCapacityFactors() |
CacheTopology |
getCurrentTopology() |
List<Address> |
getExpectedMembers()
The members of the cache.
|
CacheJoinInfo |
getJoinInfo() |
RebalancingStatus |
getRebalancingStatus() |
CacheTopology |
getStableTopology()
Whenever a new cache topology without a
pendingCH and with at least numOwners owners for each
segment is installed, and the cache is AvailabilityMode.AVAILABLE, the current cache topology is marked
as the stable topology. |
boolean |
isRebalanceEnabled() |
boolean |
isRebalanceInProgress() |
void |
queueConflictResolution(CacheTopology conflictTopology,
Set<Address> preferredNodes)
Initiates conflict resolution using the conflictTopology, which should have already been broadcast via
this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode) |
void |
queueRebalance(List<Address> newMembers)
Queue (or start) a rebalance.
|
boolean |
resolveConflictsOnMerge() |
boolean |
restartConflictResolution(List<Address> members)
If CR is in progress, then this method cancels the current CR and starts a new CR phase with an updated topology
based upon newMembers and the previously queued CR topology
|
protected CacheTopology |
restoreCacheTopology(ScopedPersistentState state) |
void |
setInitialTopologyId(int initialTopologyId) |
CompletionStage<Void> |
setRebalanceEnabled(boolean enabled) |
CompletionStage<Void> |
shutdownCache() |
void |
startQueuedRebalance() |
String |
toString() |
void |
updateAvailabilityMode(List<Address> actualMembers,
AvailabilityMode newAvailabilityMode,
boolean cancelRebalance)
Enter a new availability mode.
|
void |
updateCurrentTopology(List<Address> newMembers)
Use the configured
ConsistentHashFactory to create a new CH
with the given members, but do not start a rebalance. |
void |
updateTopologiesAfterMerge(CacheTopology currentTopology,
CacheTopology stableTopology,
AvailabilityMode availabilityMode)
Updates both the stable and the current topologies.
|
public static final int INITIAL_TOPOLOGY_ID
public static final int INITIAL_REBALANCE_ID
public ClusterCacheStatus(EmbeddedCacheManager cacheManager, String cacheName, AvailabilityStrategy availabilityStrategy, RebalanceType rebalanceType, ClusterTopologyManagerImpl clusterTopologyManager, Transport transport, PersistentUUIDManager persistentUUIDManager, EventLogManager eventLogManager, Optional<ScopedPersistentState> state, boolean resolveConflictsOnMerge)
public CacheJoinInfo getJoinInfo()
getJoinInfo in interface AvailabilityStrategyContextpublic List<Address> getExpectedMembers()
AvailabilityStrategyContextCacheTopology.
Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the
current topology.getExpectedMembers in interface AvailabilityStrategyContextpublic void queueRebalance(List<Address> newMembers)
AvailabilityStrategyContextConsistentHashFactory to create a new balanced consistent hash
with the given members.
If there is no rebalance in progress, start a rebalance right away.
If there is a rebalance in progress, queue another rebalance.
If there is a rebalance in the queue as well, it will be replaced with the new one.
If newConsistentHash == null, remove any queued rebalance.queueRebalance in interface AvailabilityStrategyContextpublic Map<Address,Float> getCapacityFactors()
getCapacityFactors in interface AvailabilityStrategyContextpublic CacheTopology getCurrentTopology()
getCurrentTopology in interface AvailabilityStrategyContextpublic CacheTopology getStableTopology()
AvailabilityStrategyContextpendingCH and with at least numOwners owners for each
segment is installed, and the cache is AvailabilityMode.AVAILABLE, the current cache topology is marked
as the stable topology.
The same happens when a rebalance is scheduled to start, but it doesn't do anything because the current
topology is already balanced.getStableTopology in interface AvailabilityStrategyContextnull.public AvailabilityMode getAvailabilityMode()
getAvailabilityMode in interface AvailabilityStrategyContextpublic void updateAvailabilityMode(List<Address> actualMembers, AvailabilityMode newAvailabilityMode, boolean cancelRebalance)
AvailabilityStrategyContextupdateAvailabilityMode in interface AvailabilityStrategyContextpublic void updateTopologiesAfterMerge(CacheTopology currentTopology, CacheTopology stableTopology, AvailabilityMode availabilityMode)
AvailabilityStrategyContextupdateTopologiesAfterMerge in interface AvailabilityStrategyContextpublic boolean isRebalanceInProgress()
public RebalancingStatus getRebalancingStatus()
public void confirmRebalancePhase(Address member, int receivedTopologyId) throws Exception
Exceptionpublic void doHandleClusterView(int viewId)
public void updateCurrentTopology(List<Address> newMembers)
AvailabilityStrategyContextConsistentHashFactory to create a new CH
with the given members, but do not start a rebalance.
Members missing from the current topology are ignored.updateCurrentTopology in interface AvailabilityStrategyContextpublic void doMergePartitions(Map<Address,CacheStatusResponse> statusResponses)
public String getCacheName()
getCacheName in interface AvailabilityStrategyContextpublic CacheStatusResponse doJoin(Address joiner, CacheJoinInfo joinInfo)
protected CacheTopology restoreCacheTopology(ScopedPersistentState state)
protected CacheTopology createInitialCacheTopology()
public CompletionStage<Void> doLeave(Address leaver) throws Exception
Exceptionpublic void startQueuedRebalance()
public boolean isRebalanceEnabled()
public CompletionStage<Void> setRebalanceEnabled(boolean enabled)
public void forceRebalance()
public CompletionStage<Void> forceAvailabilityMode(AvailabilityMode newAvailabilityMode)
public CompletionStage<Void> shutdownCache() throws Exception
Exceptionpublic void setInitialTopologyId(int initialTopologyId)
public boolean resolveConflictsOnMerge()
resolveConflictsOnMerge in interface AvailabilityStrategyContextPartitionHandlingConfiguration.mergePolicy() != nullpublic ConsistentHash calculateConflictHash(ConsistentHash preferredHash, Set<ConsistentHash> distinctHashes, List<Address> actualMembers)
calculateConflictHash in interface AvailabilityStrategyContextpreferredHash - the base consistent hashdistinctHashes - a set of all hashes to be utilised as part of the conflict resolution hashactualMembers - a set of all valid addressespublic void queueConflictResolution(CacheTopology conflictTopology, Set<Address> preferredNodes)
AvailabilityStrategyContextthis#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)queueConflictResolution in interface AvailabilityStrategyContextconflictTopology - the topology to use during conflict resolutionpreferredNodes - the addresses that belong to the preferred partition as determined by the AvailabilityStrategypublic boolean restartConflictResolution(List<Address> members)
AvailabilityStrategyContextrestartConflictResolution in interface AvailabilityStrategyContextmembers - the latest members of the current viewCopyright © 2022 JBoss by Red Hat. All rights reserved.