Package org.infinispan.topology
Class ClusterTopologyManagerImpl
- java.lang.Object
-
- org.infinispan.topology.ClusterTopologyManagerImpl
-
- All Implemented Interfaces:
ClusterTopologyManager
public class ClusterTopologyManagerImpl extends Object implements ClusterTopologyManager
TheClusterTopologyManagerimplementation.- Since:
- 5.2
- Author:
- Dan Berindei, Pedro Ruivo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classClusterTopologyManagerImpl.ClusterViewListener-
Nested classes/interfaces inherited from interface org.infinispan.topology.ClusterTopologyManager
ClusterTopologyManager.ClusterManagerStatus
-
-
Field Summary
Fields Modifier and Type Field Description static intCLUSTER_RECOVERY_ATTEMPTSstatic intINITIAL_CONNECTION_ATTEMPTS
-
Constructor Summary
Constructors Constructor Description ClusterTopologyManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>broadcastShutdownCache(String cacheName)static booleandistLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)CompletionStage<Void>forceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode)CompletionStage<Void>forceRebalance(String cacheName)RebalancingStatusgetRebalancingStatus(String cacheName)Retrieves the rebalancing status of a cacheClusterTopologyManager.ClusterManagerStatusgetStatus()CompletionStage<CacheStatusResponse>handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId)Signals that a new member is joining the cache.CompletionStage<Void>handleLeave(String cacheName, Address leaver, int viewId)Signals that a member is leaving the cache.CompletionStage<Void>handleRebalancePhaseConfirm(String cacheName, Address node, int topologyId, Throwable throwable, int viewId)Marks the rebalance as complete on the sender.CompletionStage<Void>handleShutdownRequest(String cacheName)booleanisRebalancingEnabled()booleanisRebalancingEnabled(String cacheName)Returns whether rebalancing is enabled or disabled for this container.static booleanscatteredLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)voidsetInitialCacheTopologyId(String cacheName, int topologyId)Sets the id of the initial topology in given cache.CompletionStage<Void>setRebalancingEnabled(boolean enabled)Globally enables or disables whether automatic rebalancing should occur.CompletionStage<Void>setRebalancingEnabled(String cacheName, boolean enabled)Enables or disables rebalancing for the specified cachevoidstart()voidstop()
-
-
-
Field Detail
-
INITIAL_CONNECTION_ATTEMPTS
public static final int INITIAL_CONNECTION_ATTEMPTS
- See Also:
- Constant Field Values
-
CLUSTER_RECOVERY_ATTEMPTS
public static final int CLUSTER_RECOVERY_ATTEMPTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
getStatus
public ClusterTopologyManager.ClusterManagerStatus getStatus()
- Specified by:
getStatusin interfaceClusterTopologyManager
-
handleJoin
public CompletionStage<CacheStatusResponse> handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId)
Description copied from interface:ClusterTopologyManagerSignals that a new member is joining the cache. The returnedCacheStatusResponse.cacheTopologyis the current cache topology before the node joined. If the node is the first to join the cache, the returned topology does include the joiner, and it is nevernull.- Specified by:
handleJoinin interfaceClusterTopologyManager
-
handleLeave
public CompletionStage<Void> handleLeave(String cacheName, Address leaver, int viewId) throws Exception
Description copied from interface:ClusterTopologyManagerSignals that a member is leaving the cache.- Specified by:
handleLeavein interfaceClusterTopologyManager- Throws:
Exception
-
handleRebalancePhaseConfirm
public CompletionStage<Void> handleRebalancePhaseConfirm(String cacheName, Address node, int topologyId, Throwable throwable, int viewId) throws Exception
Description copied from interface:ClusterTopologyManagerMarks the rebalance as complete on the sender.- Specified by:
handleRebalancePhaseConfirmin interfaceClusterTopologyManager- Throws:
Exception
-
isRebalancingEnabled
public boolean isRebalancingEnabled()
- Specified by:
isRebalancingEnabledin interfaceClusterTopologyManager
-
isRebalancingEnabled
public boolean isRebalancingEnabled(String cacheName)
Description copied from interface:ClusterTopologyManagerReturns whether rebalancing is enabled or disabled for this container.- Specified by:
isRebalancingEnabledin interfaceClusterTopologyManager
-
setRebalancingEnabled
public CompletionStage<Void> setRebalancingEnabled(String cacheName, boolean enabled)
Description copied from interface:ClusterTopologyManagerEnables or disables rebalancing for the specified cache- Specified by:
setRebalancingEnabledin interfaceClusterTopologyManager
-
setRebalancingEnabled
public CompletionStage<Void> setRebalancingEnabled(boolean enabled)
Description copied from interface:ClusterTopologyManagerGlobally enables or disables whether automatic rebalancing should occur.- Specified by:
setRebalancingEnabledin interfaceClusterTopologyManager
-
forceRebalance
public CompletionStage<Void> forceRebalance(String cacheName)
- Specified by:
forceRebalancein interfaceClusterTopologyManager
-
forceAvailabilityMode
public CompletionStage<Void> forceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode)
- Specified by:
forceAvailabilityModein interfaceClusterTopologyManager
-
getRebalancingStatus
public RebalancingStatus getRebalancingStatus(String cacheName)
Description copied from interface:ClusterTopologyManagerRetrieves the rebalancing status of a cache- Specified by:
getRebalancingStatusin interfaceClusterTopologyManager
-
broadcastShutdownCache
public CompletionStage<Void> broadcastShutdownCache(String cacheName)
-
setInitialCacheTopologyId
public void setInitialCacheTopologyId(String cacheName, int topologyId)
Description copied from interface:ClusterTopologyManagerSets the id of the initial topology in given cache. This is necessary when using entry versions that contain topology id; had we started with topology id 1, newer versions would not be recognized properly.- Specified by:
setInitialCacheTopologyIdin interfaceClusterTopologyManager
-
handleShutdownRequest
public CompletionStage<Void> handleShutdownRequest(String cacheName) throws Exception
- Specified by:
handleShutdownRequestin interfaceClusterTopologyManager- Throws:
Exception
-
scatteredLostDataCheck
public static boolean scatteredLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
-
distLostDataCheck
public static boolean distLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
-
-