Interface AvailabilityStrategy
-
- All Known Implementing Classes:
PreferAvailabilityStrategy,PreferConsistencyStrategy
public interface AvailabilityStrategyImplementations decide what to do when the cache membership changes, either because new nodes joined, nodes left, or there was a merge. The decision is then applied by calling one of theAvailabilityStrategyContextmethods. The strategy can also queue actions until the current rebalance ends, and execute them ononRebalanceEnd(AvailabilityStrategyContext). Method invocations are synchronized, so it's not possible to have concurrent invocations.- Since:
- 7.0
- Author:
- Mircea Markus, Dan Berindei
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonClusterViewChange(AvailabilityStrategyContext context, List<Address> clusterMembers)Called when the cluster view changed (e.g.voidonGracefulLeave(AvailabilityStrategyContext context, Address leaver)Called when a node leaves gracefully.voidonJoin(AvailabilityStrategyContext context, Address joiner)Called when a node joins.voidonManualAvailabilityChange(AvailabilityStrategyContext context, AvailabilityMode newAvailabilityMode)Called when the administrator manually changes the availability status.voidonPartitionMerge(AvailabilityStrategyContext context, Map<Address,CacheStatusResponse> statusResponseMap)Called when two or more partitions merge, to compute the stable and current cache topologies for the merged cluster.voidonRebalanceEnd(AvailabilityStrategyContext context)Called when a rebalance ends.static ConsistentHashownersConsistentHash(CacheTopology topology, ConsistentHashFactory chFactory)Compute the read consistent hash for a topology with anullunion consistent hash.
-
-
-
Method Detail
-
ownersConsistentHash
static ConsistentHash ownersConsistentHash(CacheTopology topology, ConsistentHashFactory chFactory)
Compute the read consistent hash for a topology with anullunion consistent hash. Originally a copy ofCacheTopology.getReadConsistentHash()but differs in case of scattered cache.
-
onJoin
void onJoin(AvailabilityStrategyContext context, Address joiner)
Called when a node joins.
-
onGracefulLeave
void onGracefulLeave(AvailabilityStrategyContext context, Address leaver)
Called when a node leaves gracefully.
-
onClusterViewChange
void onClusterViewChange(AvailabilityStrategyContext context, List<Address> clusterMembers)
Called when the cluster view changed (e.g. because one or more nodes left abruptly).
-
onPartitionMerge
void onPartitionMerge(AvailabilityStrategyContext context, Map<Address,CacheStatusResponse> statusResponseMap)
Called when two or more partitions merge, to compute the stable and current cache topologies for the merged cluster.
-
onRebalanceEnd
void onRebalanceEnd(AvailabilityStrategyContext context)
Called when a rebalance ends. Can be used to re-assess the state of the cache and apply pending changes.
-
onManualAvailabilityChange
void onManualAvailabilityChange(AvailabilityStrategyContext context, AvailabilityMode newAvailabilityMode)
Called when the administrator manually changes the availability status.
-
-