Package org.infinispan.topology
Class ClusterTopologyManagerImpl
- java.lang.Object
-
- org.infinispan.topology.ClusterTopologyManagerImpl
-
- All Implemented Interfaces:
ClusterTopologyManager
public class ClusterTopologyManagerImpl extends Object implements ClusterTopologyManager
TheClusterTopologyManager
implementation.- Since:
- 5.2
- Author:
- Dan Berindei, Pedro Ruivo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ClusterTopologyManagerImpl.ClusterViewListener
-
Nested classes/interfaces inherited from interface org.infinispan.topology.ClusterTopologyManager
ClusterTopologyManager.ClusterManagerStatus
-
-
Field Summary
Fields Modifier and Type Field Description static int
CLUSTER_RECOVERY_ATTEMPTS
static int
INITIAL_CONNECTION_ATTEMPTS
-
Constructor Summary
Constructors Constructor Description ClusterTopologyManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
broadcastRebalanceStart(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
void
broadcastShutdownCache(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
void
broadcastStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
void
broadcastTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, boolean totalOrder, boolean distributed)
static boolean
distLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
protected void
fetchRebalancingStatusFromCoordinator()
void
forceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode)
void
forceRebalance(String cacheName)
RebalancingStatus
getRebalancingStatus(String cacheName)
Retrieves the rebalancing status of a cacheClusterTopologyManager.ClusterManagerStatus
getStatus()
CacheStatusResponse
handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId)
Signals that a new member is joining the cache.void
handleLeave(String cacheName, Address leaver, int viewId)
Signals that a member is leaving the cache.void
handleRebalancePhaseConfirm(String cacheName, Address node, int topologyId, Throwable throwable, int viewId)
Marks the rebalance as complete on the sender.void
handleShutdownRequest(String cacheName)
boolean
isRebalancingEnabled()
boolean
isRebalancingEnabled(String cacheName)
Returns whether rebalancing is enabled or disabled for this container.static boolean
scatteredLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
void
setInitialCacheTopologyId(String cacheName, int topologyId)
Sets the id of the initial topology in given cache.void
setRebalancingEnabled(boolean enabled)
Globally enables or disables whether automatic rebalancing should occur.void
setRebalancingEnabled(String cacheName, boolean enabled)
Enables or disables rebalancing for the specified cachevoid
start()
void
stop()
-
-
-
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:
getStatus
in interfaceClusterTopologyManager
-
handleJoin
public CacheStatusResponse handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) throws Exception
Description copied from interface:ClusterTopologyManager
Signals that a new member is joining the cache. The returnedCacheStatusResponse.cacheTopology
is 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:
handleJoin
in interfaceClusterTopologyManager
- Throws:
Exception
-
handleLeave
public void handleLeave(String cacheName, Address leaver, int viewId) throws Exception
Description copied from interface:ClusterTopologyManager
Signals that a member is leaving the cache.- Specified by:
handleLeave
in interfaceClusterTopologyManager
- Throws:
Exception
-
handleRebalancePhaseConfirm
public void handleRebalancePhaseConfirm(String cacheName, Address node, int topologyId, Throwable throwable, int viewId) throws Exception
Description copied from interface:ClusterTopologyManager
Marks the rebalance as complete on the sender.- Specified by:
handleRebalancePhaseConfirm
in interfaceClusterTopologyManager
- Throws:
Exception
-
broadcastRebalanceStart
public void broadcastRebalanceStart(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
- Specified by:
broadcastRebalanceStart
in interfaceClusterTopologyManager
-
broadcastTopologyUpdate
public void broadcastTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, boolean totalOrder, boolean distributed)
- Specified by:
broadcastTopologyUpdate
in interfaceClusterTopologyManager
-
broadcastStableTopologyUpdate
public void broadcastStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed)
- Specified by:
broadcastStableTopologyUpdate
in interfaceClusterTopologyManager
-
isRebalancingEnabled
public boolean isRebalancingEnabled()
- Specified by:
isRebalancingEnabled
in interfaceClusterTopologyManager
-
isRebalancingEnabled
public boolean isRebalancingEnabled(String cacheName)
Description copied from interface:ClusterTopologyManager
Returns whether rebalancing is enabled or disabled for this container.- Specified by:
isRebalancingEnabled
in interfaceClusterTopologyManager
-
setRebalancingEnabled
public void setRebalancingEnabled(String cacheName, boolean enabled)
Description copied from interface:ClusterTopologyManager
Enables or disables rebalancing for the specified cache- Specified by:
setRebalancingEnabled
in interfaceClusterTopologyManager
-
setRebalancingEnabled
public void setRebalancingEnabled(boolean enabled)
Description copied from interface:ClusterTopologyManager
Globally enables or disables whether automatic rebalancing should occur.- Specified by:
setRebalancingEnabled
in interfaceClusterTopologyManager
-
forceRebalance
public void forceRebalance(String cacheName)
- Specified by:
forceRebalance
in interfaceClusterTopologyManager
-
forceAvailabilityMode
public void forceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode)
- Specified by:
forceAvailabilityMode
in interfaceClusterTopologyManager
-
getRebalancingStatus
public RebalancingStatus getRebalancingStatus(String cacheName)
Description copied from interface:ClusterTopologyManager
Retrieves the rebalancing status of a cache- Specified by:
getRebalancingStatus
in interfaceClusterTopologyManager
-
broadcastShutdownCache
public void broadcastShutdownCache(String cacheName, CacheTopology cacheTopology, boolean totalOrder, boolean distributed) throws Exception
- Specified by:
broadcastShutdownCache
in interfaceClusterTopologyManager
- Throws:
Exception
-
setInitialCacheTopologyId
public void setInitialCacheTopologyId(String cacheName, int topologyId)
Description copied from interface:ClusterTopologyManager
Sets 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:
setInitialCacheTopologyId
in interfaceClusterTopologyManager
-
handleShutdownRequest
public void handleShutdownRequest(String cacheName) throws Exception
- Specified by:
handleShutdownRequest
in interfaceClusterTopologyManager
- Throws:
Exception
-
scatteredLostDataCheck
public static boolean scatteredLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
-
distLostDataCheck
public static boolean distLostDataCheck(ConsistentHash stableCH, List<Address> newMembers)
-
-