Package org.infinispan.distribution.impl
Class DistributionManagerImpl
java.lang.Object
org.infinispan.distribution.impl.DistributionManagerImpl
- All Implemented Interfaces:
DistributionManager
@MBean(objectName="DistributionManager",
description="Component that handles distribution of content across a cluster")
public class DistributionManagerImpl
extends Object
implements DistributionManager
The default distribution manager implementation
- Since:
- 4.0
- Author:
- Manik Surtani, Vladimir Blagojevic, Mircea.Markus@jboss.com, Bela Ban, Dan Berindei <dan@infinispan.org>, anistor@redhat.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateLocalizedCacheTopology
(CacheTopology cacheTopology) boolean
isAffectedByRehash
(Object key) Tests whether a given key is affected by a rehash that may be in progress.boolean
Tests whether the current instance has completed joining the clusterboolean
isLocatedLocally
(String key) boolean
Tests whether a rehash is in progressstatic LocalizedCacheTopology
makeSingletonTopology
(CacheMode cacheMode, KeyPartitioner keyPartitioner, int numSegments, Address localAddress) void
setCacheTopology
(CacheTopology cacheTopology)
-
Constructor Details
-
DistributionManagerImpl
public DistributionManagerImpl()
-
-
Method Details
-
getReadConsistentHash
- Specified by:
getReadConsistentHash
in interfaceDistributionManager
- Returns:
- the consistent hash used for reading.
-
getWriteConsistentHash
- Specified by:
getWriteConsistentHash
in interfaceDistributionManager
- Returns:
- the consistent hash used for writing.
-
isAffectedByRehash
@ManagedOperation(description="Determines whether a given key is affected by an ongoing rehash, if any.", displayName="Could key be affected by rehash?") public boolean isAffectedByRehash(@Parameter(name="key",description="Key to check") Object key) Description copied from interface:DistributionManager
Tests whether a given key is affected by a rehash that may be in progress. If no rehash is in progress, this method returns false. Helps determine whether additional steps are necessary in handling an operation with a given key.- Specified by:
isAffectedByRehash
in interfaceDistributionManager
- Parameters:
key
- key to test- Returns:
- whether a key is affected by a rehash
-
isRehashInProgress
public boolean isRehashInProgress()Tests whether a rehash is in progress- Specified by:
isRehashInProgress
in interfaceDistributionManager
- Returns:
- true if a rehash is in progress, false otherwise
-
isJoinComplete
public boolean isJoinComplete()Description copied from interface:DistributionManager
Tests whether the current instance has completed joining the cluster- Specified by:
isJoinComplete
in interfaceDistributionManager
- Returns:
- true if join is in progress, false otherwise
-
isLocatedLocally
@ManagedOperation(description="Tells you whether a given key would be written to this instance of the cache according to the consistent hashing algorithm. Only works with String keys.", displayName="Is key local?") public boolean isLocatedLocally(@Parameter(name="key",description="Key to query") String key) -
locateKey
-
getCacheTopology
- Specified by:
getCacheTopology
in interfaceDistributionManager
- Returns:
- the current cache topology, which includes the read and write consistent hashes.
-
setCacheTopology
- Specified by:
setCacheTopology
in interfaceDistributionManager
-
createLocalizedCacheTopology
- Specified by:
createLocalizedCacheTopology
in interfaceDistributionManager
-
makeSingletonTopology
public static LocalizedCacheTopology makeSingletonTopology(CacheMode cacheMode, KeyPartitioner keyPartitioner, int numSegments, Address localAddress)
-