Package org.infinispan.topology
Class ClusterTopologyManagerImpl
java.lang.Object
org.infinispan.topology.ClusterTopologyManagerImpl
- All Implemented Interfaces:
GlobalStateProvider
,ClusterTopologyManager
public class ClusterTopologyManagerImpl
extends Object
implements ClusterTopologyManager, GlobalStateProvider
The
ClusterTopologyManager
implementation.- Since:
- 5.2
- Author:
- Dan Berindei, Pedro Ruivo
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.topology.ClusterTopologyManager
ClusterTopologyManager.ClusterManagerStatus
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbroadcastShutdownCache
(String cacheName) currentJoiners
(String cacheName) Returns the list of nodes that joined the cache with the givencacheName
if the current node is the coordinator.static boolean
distLostDataCheck
(ConsistentHash stableCH, List<Address> newMembers) forceAvailabilityMode
(String cacheName, AvailabilityMode availabilityMode) forceRebalance
(String cacheName) getRebalancingStatus
(String cacheName) Retrieves the rebalancing status of a cachehandleJoin
(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) Signals that a new member is joining the cache.handleLeave
(String cacheName, Address leaver, int viewId) Signals that a member is leaving the cache.handleRebalancePhaseConfirm
(String cacheName, Address node, int topologyId, Throwable throwable, int viewId) Marks the rebalance as complete on the sender.handleShutdownRequest
(String cacheName) boolean
boolean
isRebalancingEnabled
(String cacheName) Returns whether rebalancing is enabled or disabled for this container.void
prepareForPersist
(ScopedPersistentState globalState) This method is invoked by theGlobalStateManager
just before persisting the global statevoid
prepareForRestore
(ScopedPersistentState globalState) This method is invoked by theGlobalStateManager
after starting up to notify that global state has been restored.void
preStart()
static boolean
scatteredLostDataCheck
(ConsistentHash stableCH, List<Address> newMembers) void
setInitialCacheTopologyId
(String cacheName, int topologyId) Sets the id of the initial topology in given cache.setRebalancingEnabled
(boolean enabled) Globally enables or disables whether automatic rebalancing should occur.setRebalancingEnabled
(String cacheName, boolean enabled) Enables or disables rebalancing for the specified cachevoid
start()
void
stop()
boolean
useCurrentTopologyAsStable
(String cacheName, boolean force)
-
Field Details
-
INITIAL_CONNECTION_ATTEMPTS
public static final int INITIAL_CONNECTION_ATTEMPTS- See Also:
-
CLUSTER_RECOVERY_ATTEMPTS
public static final int CLUSTER_RECOVERY_ATTEMPTS- See Also:
-
-
Constructor Details
-
ClusterTopologyManagerImpl
public ClusterTopologyManagerImpl()
-
-
Method Details
-
preStart
public void preStart() -
start
public void start() -
stop
public void stop() -
getStatus
- Specified by:
getStatus
in interfaceClusterTopologyManager
-
currentJoiners
Description copied from interface:ClusterTopologyManager
Returns the list of nodes that joined the cache with the givencacheName
if the current node is the coordinator. If the node is not the coordinator, the method returns null.- Specified by:
currentJoiners
in interfaceClusterTopologyManager
-
handleJoin
public CompletionStage<CacheStatusResponse> handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) 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
-
handleLeave
public CompletionStage<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 CompletionStage<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
-
prepareForPersist
Description copied from interface:GlobalStateProvider
This method is invoked by theGlobalStateManager
just before persisting the global state- Specified by:
prepareForPersist
in interfaceGlobalStateProvider
-
prepareForRestore
Description copied from interface:GlobalStateProvider
This method is invoked by theGlobalStateManager
after starting up to notify that global state has been restored.- Specified by:
prepareForRestore
in interfaceGlobalStateProvider
-
isRebalancingEnabled
public boolean isRebalancingEnabled()- Specified by:
isRebalancingEnabled
in interfaceClusterTopologyManager
-
isRebalancingEnabled
Description copied from interface:ClusterTopologyManager
Returns whether rebalancing is enabled or disabled for this container.- Specified by:
isRebalancingEnabled
in interfaceClusterTopologyManager
-
setRebalancingEnabled
Description copied from interface:ClusterTopologyManager
Enables or disables rebalancing for the specified cache- Specified by:
setRebalancingEnabled
in interfaceClusterTopologyManager
-
setRebalancingEnabled
Description copied from interface:ClusterTopologyManager
Globally enables or disables whether automatic rebalancing should occur.- Specified by:
setRebalancingEnabled
in interfaceClusterTopologyManager
-
forceRebalance
- Specified by:
forceRebalance
in interfaceClusterTopologyManager
-
forceAvailabilityMode
public CompletionStage<Void> forceAvailabilityMode(String cacheName, AvailabilityMode availabilityMode) - Specified by:
forceAvailabilityMode
in interfaceClusterTopologyManager
-
getRebalancingStatus
Description copied from interface:ClusterTopologyManager
Retrieves the rebalancing status of a cache- Specified by:
getRebalancingStatus
in interfaceClusterTopologyManager
-
broadcastShutdownCache
-
setInitialCacheTopologyId
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
- Specified by:
handleShutdownRequest
in interfaceClusterTopologyManager
- Throws:
Exception
-
scatteredLostDataCheck
-
useCurrentTopologyAsStable
- Specified by:
useCurrentTopologyAsStable
in interfaceClusterTopologyManager
-
distLostDataCheck
-