public class LocalTopologyManagerImpl extends Object implements LocalTopologyManager, GlobalStateProvider
LocalTopologyManager
implementation.Constructor and Description |
---|
LocalTopologyManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
confirmRebalance(String cacheName,
int topologyId,
int rebalanceId,
Throwable throwable)
Confirm that the local cache
cacheName has finished receiving the new data for topology
topologyId . |
protected void |
doHandleRebalance(int viewId,
org.infinispan.topology.LocalCacheStatus cacheStatus,
CacheTopology cacheTopology,
String cacheName,
Address sender) |
protected void |
doHandleStableTopologyUpdate(String cacheName,
CacheTopology newStableTopology,
int viewId,
Address sender,
org.infinispan.topology.LocalCacheStatus cacheStatus) |
protected boolean |
doHandleTopologyUpdate(String cacheName,
CacheTopology cacheTopology,
AvailabilityMode availabilityMode,
int viewId,
Address sender,
org.infinispan.topology.LocalCacheStatus cacheStatus)
Update the cache topology in the LocalCacheStatus and pass it to the CacheTopologyHandler.
|
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) |
void |
handleRebalance(String cacheName,
CacheTopology cacheTopology,
int viewId,
Address sender)
Performs the state transfer.
|
void |
handleStableTopologyUpdate(String cacheName,
CacheTopology newStableTopology,
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.
|
void |
inject(Transport transport,
ExecutorService asyncTransportExecutor,
GlobalComponentRegistry gcr,
TimeService timeService,
GlobalStateManager globalStateManager) |
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 by
cacheName is using total order. |
CacheTopology |
join(String cacheName,
CacheJoinInfo joinInfo,
CacheTopologyHandler stm,
PartitionHandlingManager phm)
Forwards the join request to the coordinator.
|
void |
leave(String cacheName)
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 |
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 inject(Transport transport, ExecutorService asyncTransportExecutor, GlobalComponentRegistry gcr, TimeService timeService, GlobalStateManager globalStateManager)
public void start()
public void stop()
public CacheTopology join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm) throws Exception
LocalTopologyManager
join
in interface LocalTopologyManager
Exception
public void leave(String cacheName)
LocalTopologyManager
leave
in interface LocalTopologyManager
public void confirmRebalance(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.
confirmRebalance
in interface LocalTopologyManager
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.throwable
- null
unless local rebalance ended because of an error.public ManagerStatusResponse handleStatusRequest(int viewId)
LocalTopologyManager
handleStatusRequest
in interface LocalTopologyManager
public void handleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender) throws InterruptedException
LocalTopologyManager
handleTopologyUpdate
in interface LocalTopologyManager
InterruptedException
protected boolean doHandleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender, org.infinispan.topology.LocalCacheStatus cacheStatus)
true
if the topology was applied, false
if it was ignored.public void handleStableTopologyUpdate(String cacheName, CacheTopology newStableTopology, Address sender, int viewId)
LocalTopologyManager
handleStableTopologyUpdate
in interface LocalTopologyManager
protected void doHandleStableTopologyUpdate(String cacheName, CacheTopology newStableTopology, int viewId, Address sender, org.infinispan.topology.LocalCacheStatus cacheStatus)
public void handleRebalance(String cacheName, CacheTopology cacheTopology, int viewId, Address sender) throws InterruptedException
LocalTopologyManager
handleRebalance
in interface LocalTopologyManager
InterruptedException
protected void doHandleRebalance(int viewId, org.infinispan.topology.LocalCacheStatus cacheStatus, CacheTopology cacheTopology, String cacheName, Address sender)
public CacheTopology getCacheTopology(String cacheName)
getCacheTopology
in interface LocalTopologyManager
public CacheTopology getStableCacheTopology(String cacheName)
getStableCacheTopology
in interface LocalTopologyManager
public boolean isTotalOrderCache(String cacheName)
LocalTopologyManager
cacheName
is using total order.
If this component is not running or the cacheName
is not defined, it returns false
.isTotalOrderCache
in interface LocalTopologyManager
true
if the cache is using the total order protocol, false
otherwise.public boolean isRebalancingEnabled() throws Exception
LocalTopologyManager
isRebalancingEnabled
in interface LocalTopologyManager
Exception
public void setRebalancingEnabled(boolean enabled) throws Exception
LocalTopologyManager
setRebalancingEnabled
in interface LocalTopologyManager
Exception
public boolean isCacheRebalancingEnabled(String cacheName) throws Exception
LocalTopologyManager
isCacheRebalancingEnabled
in interface LocalTopologyManager
Exception
public void setCacheRebalancingEnabled(String cacheName, boolean enabled) throws Exception
LocalTopologyManager
setCacheRebalancingEnabled
in interface LocalTopologyManager
Exception
public RebalancingStatus getRebalancingStatus(String cacheName) throws Exception
LocalTopologyManager
getRebalancingStatus
in interface LocalTopologyManager
Exception
public String getClusterAvailability()
public AvailabilityMode getCacheAvailability(String cacheName)
LocalTopologyManager
getCacheAvailability
in interface LocalTopologyManager
public void setCacheAvailability(String cacheName, AvailabilityMode availabilityMode) throws Exception
LocalTopologyManager
setCacheAvailability
in interface LocalTopologyManager
Exception
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 © 2018 JBoss, a division of Red Hat. All rights reserved.