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 voidbroadcastRebalanceStart(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)voidbroadcastShutdownCache(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)voidbroadcastStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)voidbroadcastTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, boolean totalOrder, boolean distributed)static booleandistLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)protected voidfetchRebalancingStatusFromCoordinator()voidforceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode)voidforceRebalance(String cacheName)RebalancingStatusgetRebalancingStatus(String cacheName)Retrieves the rebalancing status of a cacheClusterTopologyManager.ClusterManagerStatusgetStatus()CacheStatusResponsehandleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId)Signals that a new member is joining the cache.voidhandleLeave(String cacheName, Address leaver, int viewId)Signals that a member is leaving the cache.voidhandleRebalancePhaseConfirm(String cacheName, Address node, int topologyId, Throwable throwable, int viewId)Marks the rebalance as complete on the sender.voidhandleShutdownRequest(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.voidsetRebalancingEnabled(boolean enabled)Globally enables or disables whether automatic rebalancing should occur.voidsetRebalancingEnabled(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()
-
fetchRebalancingStatusFromCoordinator
protected void fetchRebalancingStatusFromCoordinator()
-
stop
public void stop()
-
getStatus
public ClusterTopologyManager.ClusterManagerStatus getStatus()
- Specified by:
getStatusin interfaceClusterTopologyManager
-
handleJoin
public CacheStatusResponse handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) throws Exception
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- Throws:
Exception
-
handleLeave
public 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 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
-
broadcastRebalanceStart
public void broadcastRebalanceStart(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
- Specified by:
broadcastRebalanceStartin interfaceClusterTopologyManager
-
broadcastTopologyUpdate
public void broadcastTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, boolean totalOrder, boolean distributed)
- Specified by:
broadcastTopologyUpdatein interfaceClusterTopologyManager
-
broadcastStableTopologyUpdate
public void broadcastStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
- Specified by:
broadcastStableTopologyUpdatein interfaceClusterTopologyManager
-
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 void setRebalancingEnabled(String cacheName, boolean enabled)
Description copied from interface:ClusterTopologyManagerEnables or disables rebalancing for the specified cache- Specified by:
setRebalancingEnabledin interfaceClusterTopologyManager
-
setRebalancingEnabled
public void setRebalancingEnabled(boolean enabled)
Description copied from interface:ClusterTopologyManagerGlobally enables or disables whether automatic rebalancing should occur.- Specified by:
setRebalancingEnabledin interfaceClusterTopologyManager
-
forceRebalance
public void forceRebalance(String cacheName)
- Specified by:
forceRebalancein interfaceClusterTopologyManager
-
forceAvailabilityMode
public 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 void broadcastShutdownCache(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed) throws Exception
- Specified by:
broadcastShutdownCachein interfaceClusterTopologyManager- Throws:
Exception
-
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 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)
-
-