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 DistributionManagerThe 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
Constructors Constructor Description DistributionManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalizedCacheTopologycreateLocalizedCacheTopology(CacheTopology cacheTopology)LocalizedCacheTopologygetCacheTopology()ConsistentHashgetReadConsistentHash()ConsistentHashgetWriteConsistentHash()booleanisAffectedByRehash(Object key)Tests whether a given key is affected by a rehash that may be in progress.booleanisJoinComplete()Tests whether the current instance has completed joining the clusterbooleanisLocatedLocally(String key)booleanisRehashInProgress()Tests whether a rehash is in progressList<String>locateKey(String key)static LocalizedCacheTopologymakeSingletonTopology(CacheMode cacheMode, KeyPartitioner keyPartitioner, int numSegments, Address localAddress)voidsetCacheTopology(CacheTopology cacheTopology)
-
-
-
Method Detail
-
getReadConsistentHash
public ConsistentHash getReadConsistentHash()
- Specified by:
getReadConsistentHashin interfaceDistributionManager- Returns:
- the consistent hash used for reading.
-
getWriteConsistentHash
public ConsistentHash getWriteConsistentHash()
- Specified by:
getWriteConsistentHashin 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:DistributionManagerTests 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:
isAffectedByRehashin 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:
isRehashInProgressin interfaceDistributionManager- Returns:
- true if a rehash is in progress, false otherwise
-
isJoinComplete
public boolean isJoinComplete()
Description copied from interface:DistributionManagerTests whether the current instance has completed joining the cluster- Specified by:
isJoinCompletein 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
@ManagedOperation(description="Shows the addresses of the nodes where a write operation would store the entry associated with the specified key. Only works with String keys.", displayName="Locate key") public List<String> locateKey(@Parameter(name="key",description="Key to locate") String key)
-
getCacheTopology
public LocalizedCacheTopology getCacheTopology()
- Specified by:
getCacheTopologyin interfaceDistributionManager- Returns:
- the current cache topology, which includes the read and write consistent hashes.
-
setCacheTopology
public void setCacheTopology(CacheTopology cacheTopology)
- Specified by:
setCacheTopologyin interfaceDistributionManager
-
createLocalizedCacheTopology
public LocalizedCacheTopology createLocalizedCacheTopology(CacheTopology cacheTopology)
- Specified by:
createLocalizedCacheTopologyin interfaceDistributionManager
-
makeSingletonTopology
public static LocalizedCacheTopology makeSingletonTopology(CacheMode cacheMode, KeyPartitioner keyPartitioner, int numSegments, Address localAddress)
-
-