@MBean(objectName="LocalTopologyManager", description="Controls the cache membership and state transfer") public class LocalTopologyManagerImpl extends Object implements LocalTopologyManager, GlobalStateProvider
LocalTopologyManager
implementation.Constructor and Description |
---|
LocalTopologyManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
cacheShutdown(String name)
Initiates a cluster-wide cache shutdown for the specified cache
|
void |
confirmRebalancePhase(String cacheName,
int topologyId,
int rebalanceId,
Throwable throwable)
Confirm that the local cache
cacheName has finished receiving the new data for topology
topologyId . |
CompletionStage<Object> |
executeOnCoordinatorRetry(ReplicableCommand command,
int viewId,
long endNanos) |
AvailabilityMode |
getCacheAvailability(String cacheName)
Retrieves the availability state of a cache.
|
CacheTopology |
getCacheTopology(String cacheName) |
String |
getClusterAvailability() |
PersistentUUID |
getPersistentUUID()
Returns the local UUID of this node.
|
RebalancingStatus |
getRebalancingStatus(String cacheName)
Retrieve the rebalancing status for the specified cache
|
CacheTopology |
getStableCacheTopology(String cacheName) |
CompletionStage<Void> |
handleCacheShutdown(String cacheName)
Handles the local operations related to gracefully shutting down a cache
|
CompletionStage<CacheTopology> |
handleJoinResponse(String cacheName,
org.infinispan.topology.LocalCacheStatus cacheStatus,
CacheStatusResponse initialStatus) |
CompletionStage<Void> |
handleRebalance(String cacheName,
CacheTopology cacheTopology,
int viewId,
Address sender)
Performs the state transfer.
|
CompletionStage<Void> |
handleStableTopologyUpdate(String cacheName,
CacheTopology newStableTopology,
Address sender,
int viewId)
Update the stable cache topology.
|
CompletionStage<ManagerStatusResponse> |
handleStatusRequest(int viewId)
Recovers the current topology information for all running caches and returns it to the coordinator.
|
CompletionStage<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.
|
CompletionStage<CacheTopology> |
join(String cacheName,
CacheJoinInfo joinInfo,
CacheTopologyHandler stm,
PartitionHandlingManager phm)
Forwards the join request to the coordinator.
|
void |
leave(String cacheName,
long timeout)
Forwards the leave request to the coordinator.
|
void |
prepareForPersist(ScopedPersistentState state)
This method is invoked by the
GlobalStateManager just before
persisting the global state |
void |
prepareForRestore(ScopedPersistentState state)
This method is invoked by the
GlobalStateManager after starting up to notify
that global state has been restored. |
void |
preStart() |
CompletionStage<CacheStatusResponse> |
sendJoinRequest(String cacheName,
CacheJoinInfo joinInfo,
long timeout,
long endTime) |
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.
|
void |
start() |
void |
stop() |
public void preStart()
public void start()
public void stop()
public CompletionStage<CacheTopology> join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm)
LocalTopologyManager
join
in interface LocalTopologyManager
public CompletionStage<CacheStatusResponse> sendJoinRequest(String cacheName, CacheJoinInfo joinInfo, long timeout, long endTime)
public CompletionStage<CacheTopology> handleJoinResponse(String cacheName, org.infinispan.topology.LocalCacheStatus cacheStatus, CacheStatusResponse initialStatus)
public void leave(String cacheName, long timeout)
LocalTopologyManager
leave
in interface LocalTopologyManager
public void confirmRebalancePhase(String cacheName, int topologyId, int rebalanceId, Throwable throwable)
LocalTopologyManager
cacheName
has finished receiving the new data for topology
topologyId
.
The coordinator can change during the state transfer, so we make the rebalance RPC async and we send the response as a different command.
confirmRebalancePhase
in interface LocalTopologyManager
cacheName
- the name of the cachetopologyId
- the current topology id of the node at the time the rebalance is completed.rebalanceId
- the id of the current rebalancethrowable
- null
unless local rebalance ended because of an error.public CompletionStage<ManagerStatusResponse> handleStatusRequest(int viewId)
LocalTopologyManager
handleStatusRequest
in interface LocalTopologyManager
viewId
- The coordinator's view idpublic CompletionStage<Void> handleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender)
LocalTopologyManager
handleTopologyUpdate
in interface LocalTopologyManager
public CompletionStage<Void> handleStableTopologyUpdate(String cacheName, CacheTopology newStableTopology, Address sender, int viewId)
LocalTopologyManager
Mostly needed for backup, so that a new coordinator can recover the stable topology of the cluster.
handleStableTopologyUpdate
in interface LocalTopologyManager
public CompletionStage<Void> handleRebalance(String cacheName, CacheTopology cacheTopology, int viewId, Address sender)
LocalTopologyManager
handleRebalance
in interface LocalTopologyManager
public CacheTopology getCacheTopology(String cacheName)
getCacheTopology
in interface LocalTopologyManager
public CacheTopology getStableCacheTopology(String cacheName)
getStableCacheTopology
in interface LocalTopologyManager
@ManagedAttribute(description="Rebalancing enabled", displayName="Rebalancing enabled", dataType=TRAIT, writable=true) public boolean isRebalancingEnabled()
LocalTopologyManager
isRebalancingEnabled
in interface LocalTopologyManager
public void setRebalancingEnabled(boolean enabled)
LocalTopologyManager
setRebalancingEnabled
in interface LocalTopologyManager
public boolean isCacheRebalancingEnabled(String cacheName)
LocalTopologyManager
isCacheRebalancingEnabled
in interface LocalTopologyManager
public CompletionStage<Object> executeOnCoordinatorRetry(ReplicableCommand command, int viewId, long endNanos)
public void setCacheRebalancingEnabled(String cacheName, boolean enabled)
LocalTopologyManager
setCacheRebalancingEnabled
in interface LocalTopologyManager
public RebalancingStatus getRebalancingStatus(String cacheName)
LocalTopologyManager
getRebalancingStatus
in interface LocalTopologyManager
@ManagedAttribute(description="Cluster availability", displayName="Cluster availability", dataType=TRAIT, writable=false) public String getClusterAvailability()
public AvailabilityMode getCacheAvailability(String cacheName)
LocalTopologyManager
getCacheAvailability
in interface LocalTopologyManager
public void setCacheAvailability(String cacheName, AvailabilityMode availabilityMode)
LocalTopologyManager
setCacheAvailability
in interface LocalTopologyManager
public void cacheShutdown(String name)
LocalTopologyManager
cacheShutdown
in interface LocalTopologyManager
public CompletionStage<Void> handleCacheShutdown(String cacheName)
LocalTopologyManager
handleCacheShutdown
in interface LocalTopologyManager
public void prepareForPersist(ScopedPersistentState state)
GlobalStateProvider
GlobalStateManager
just before
persisting the global stateprepareForPersist
in interface GlobalStateProvider
public void prepareForRestore(ScopedPersistentState state)
GlobalStateProvider
GlobalStateManager
after starting up to notify
that global state has been restored.prepareForRestore
in interface GlobalStateProvider
public PersistentUUID getPersistentUUID()
LocalTopologyManager
getPersistentUUID
in interface LocalTopologyManager
Copyright © 2021 JBoss by Red Hat. All rights reserved.