Package org.infinispan.topology
Interface LocalTopologyManager
-
- All Known Implementing Classes:
AbstractControlledLocalTopologyManager
,LocalTopologyManagerImpl
public interface LocalTopologyManager
Runs on every node and handles the communication with theClusterTopologyManager
.- Since:
- 5.2
- Author:
- Dan Berindei
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cacheShutdown(String name)
Initiates a cluster-wide cache shutdown for the specified cachevoid
confirmRebalancePhase(String cacheName, int topologyId, int rebalanceId, Throwable throwable)
Confirm that the local cachecacheName
has finished receiving the new data for topologytopologyId
.AvailabilityMode
getCacheAvailability(String cacheName)
Retrieves the availability state of a cache.CacheTopology
getCacheTopology(String cacheName)
PersistentUUID
getPersistentUUID()
Returns the local UUID of this node.RebalancingStatus
getRebalancingStatus(String cacheName)
Retrieve the rebalancing status for the specified cacheCacheTopology
getStableCacheTopology(String cacheName)
void
handleCacheShutdown(String cacheName)
Handles the local operations related to gracefully shutting down a cachevoid
handleRebalance(String cacheName, CacheTopology cacheTopology, int viewId, Address sender)
Performs the state transfer.void
handleStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, Address sender, int viewId)
Update the stable cache topology.ManagerStatusResponse
handleStatusRequest(int viewId)
Recovers the current topology information for all running caches and returns it to the coordinator.void
handleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender)
Updates the current and/or pending consistent hash, without transferring any state.boolean
isCacheRebalancingEnabled(String cacheName)
Checks whether rebalancing is enabled for the specified cache.boolean
isRebalancingEnabled()
Checks whether rebalancing is enabled for the entire cluster.boolean
isTotalOrderCache(String cacheName)
Checks if the cache defined bycacheName
is using total order.CacheTopology
join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, org.infinispan.partitionhandling.impl.PartitionHandlingManager phm)
Forwards the join request to the coordinator.void
leave(String cacheName)
Forwards the leave request to the coordinator.void
setCacheAvailability(String cacheName, AvailabilityMode availabilityMode)
Updates the availability state of a cache (for the entire cluster).void
setCacheRebalancingEnabled(String cacheName, boolean enabled)
Enable or disable rebalancing for the specified cache.void
setRebalancingEnabled(boolean enabled)
Enable or disable rebalancing in the entire cluster.
-
-
-
Method Detail
-
join
CacheTopology join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, org.infinispan.partitionhandling.impl.PartitionHandlingManager phm) throws Exception
Forwards the join request to the coordinator.- Returns:
- The current consistent hash.
- Throws:
Exception
-
leave
void leave(String cacheName)
Forwards the leave request to the coordinator.
-
confirmRebalancePhase
void confirmRebalancePhase(String cacheName, int topologyId, int rebalanceId, Throwable throwable)
Confirm that the local cachecacheName
has finished receiving the new data for topologytopologyId
.The coordinator can change during the state transfer, so we make the rebalance RPC async and we send the response as a different command.
- Parameters:
cacheName
- the name of the cachetopologyId
- the current topology id of the node at the time the rebalance is completed. This must be >= than the one when rebalance starts.rebalanceId
-throwable
-null
unless local rebalance ended because of an error.
-
handleStatusRequest
ManagerStatusResponse handleStatusRequest(int viewId)
Recovers the current topology information for all running caches and returns it to the coordinator.- Parameters:
viewId
-
-
handleTopologyUpdate
void handleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender) throws InterruptedException
Updates the current and/or pending consistent hash, without transferring any state.- Throws:
InterruptedException
-
handleStableTopologyUpdate
void handleStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, Address sender, int viewId)
Update the stable cache topology. Mostly needed for backup, so that a new coordinator can recover the stable topology of the cluster.
-
handleRebalance
void handleRebalance(String cacheName, CacheTopology cacheTopology, int viewId, Address sender) throws InterruptedException
Performs the state transfer.- Throws:
InterruptedException
-
getCacheTopology
CacheTopology getCacheTopology(String cacheName)
- Returns:
- the current topology for a cache.
-
getStableCacheTopology
CacheTopology getStableCacheTopology(String cacheName)
- Returns:
- the last stable topology for a cache.
-
isTotalOrderCache
boolean isTotalOrderCache(String cacheName)
Checks if the cache defined bycacheName
is using total order. If this component is not running or thecacheName
is not defined, it returnsfalse
.- Returns:
true
if the cache is using the total order protocol,false
otherwise.
-
isRebalancingEnabled
boolean isRebalancingEnabled() throws Exception
Checks whether rebalancing is enabled for the entire cluster.- Throws:
Exception
-
isCacheRebalancingEnabled
boolean isCacheRebalancingEnabled(String cacheName) throws Exception
Checks whether rebalancing is enabled for the specified cache.- Throws:
Exception
-
setRebalancingEnabled
void setRebalancingEnabled(boolean enabled) throws Exception
Enable or disable rebalancing in the entire cluster.- Throws:
Exception
-
setCacheRebalancingEnabled
void setCacheRebalancingEnabled(String cacheName, boolean enabled) throws Exception
Enable or disable rebalancing for the specified cache.- Throws:
Exception
-
getRebalancingStatus
RebalancingStatus getRebalancingStatus(String cacheName) throws Exception
Retrieve the rebalancing status for the specified cache- Throws:
Exception
-
getCacheAvailability
AvailabilityMode getCacheAvailability(String cacheName)
Retrieves the availability state of a cache.
-
setCacheAvailability
void setCacheAvailability(String cacheName, AvailabilityMode availabilityMode) throws Exception
Updates the availability state of a cache (for the entire cluster).- Throws:
Exception
-
getPersistentUUID
PersistentUUID getPersistentUUID()
Returns the local UUID of this node. If global state persistence is enabled, this UUID will be saved and reused across restarts
-
cacheShutdown
void cacheShutdown(String name) throws Exception
Initiates a cluster-wide cache shutdown for the specified cache- Throws:
Exception
-
handleCacheShutdown
void handleCacheShutdown(String cacheName)
Handles the local operations related to gracefully shutting down a cache
-
-