public class DistributionManagerImpl extends Object implements DistributionManager
| Constructor and Description |
|---|
DistributionManagerImpl()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
Collection<Address> |
getAffectedNodes(Collection<Object> affectedKeys)
A helper method that retrieves a list of nodes affected by operations on a set of keys.
|
ConsistentHash |
getConsistentHash()
Retrieves the consistent hash instance currently in use, an instance of the configured ConsistentHash
class (which defaults to
DefaultConsistentHash. |
DataLocality |
getLocality(Object key)
Returns the data locality characteristics of a given key.
|
Address |
getPrimaryLocation(Object key)
Returns the first Address containing the key.
|
void |
init(Configuration configuration,
RpcManager rpcManager,
CommandsFactory cf,
CacheNotifier cacheNotifier,
StateTransferManager stateTransferManager) |
boolean |
isAffectedByRehash(Object key)
Tests whether a given key is affected by a rehash that may be in progress.
|
boolean |
isJoinComplete()
Tests whether the current instance has completed joining the cluster
|
boolean |
isLocal(Object key)
Deprecated.
|
boolean |
isLocatedLocally(String key) |
boolean |
isRehashInProgress()
Tests whether a rehash is in progress
|
List<Address> |
locate(Object key)
Locates a key in a cluster.
|
Map<Object,List<Address>> |
locateAll(Collection<Object> keys)
Locates a list of keys in a cluster.
|
Map<Object,List<Address>> |
locateAll(Collection<Object> keys,
int numOwners)
Same as
DistributionManager.locateAll(java.util.Collection), but the list of addresses only contains numOwners owners. |
List<String> |
locateKey(String key) |
InternalCacheEntry |
retrieveFromRemoteSource(Object key,
InvocationContext ctx,
boolean acquireRemoteLock)
Retrieves a cache entry from a remote source.
|
ConsistentHash |
setConsistentHash(ConsistentHash newCH)
Sets the consistent hash implementation in use.
|
String |
toString() |
void |
transformForL1(CacheEntry entry)
Transforms a cache entry so it is marked for L1 rather than the primary cache data structure.
|
public void init(Configuration configuration, RpcManager rpcManager, CommandsFactory cf, CacheNotifier cacheNotifier, StateTransferManager stateTransferManager)
@Deprecated public boolean isLocal(Object key)
DistributionManagerDistributionManager.getLocality(Object) instead.isLocal in interface DistributionManagerkey - key to testpublic DataLocality getLocality(Object key)
DistributionManagergetLocality in interface DistributionManagerkey - key to testpublic List<Address> locate(Object key)
DistributionManagerlocate in interface DistributionManagerkey - key to testpublic Address getPrimaryLocation(Object key)
DistributionManagerDistributionManager.locate(Object)getPrimaryLocation in interface DistributionManagerkey - key to testpublic Map<Object,List<Address>> locateAll(Collection<Object> keys)
DistributionManagerDistributionManager.locate(Object) the returned addresses may not be owners
of the keys if a rehash happens to be in progress or is pending, so when querying these servers, invalid responses
should be checked for and the next address checked accordingly.locateAll in interface DistributionManagerkeys - list of keys to testpublic Map<Object,List<Address>> locateAll(Collection<Object> keys, int numOwners)
DistributionManagerDistributionManager.locateAll(java.util.Collection), but the list of addresses only contains numOwners owners.locateAll in interface DistributionManagerpublic void transformForL1(CacheEntry entry)
DistributionManagertransformForL1 in interface DistributionManagerentry - entry to transformpublic InternalCacheEntry retrieveFromRemoteSource(Object key, InvocationContext ctx, boolean acquireRemoteLock) throws Exception
DistributionManagerClusteredGetCommand
and some form of quorum of responses if the responses returned are inconsistent - often the case if there is a
rehash in progress, involving nodes that the key maps to.retrieveFromRemoteSource in interface DistributionManagerkey - key to look upExceptionpublic ConsistentHash getConsistentHash()
DistributionManagerDefaultConsistentHash.getConsistentHash in interface DistributionManagerpublic ConsistentHash setConsistentHash(ConsistentHash newCH)
DistributionManagersetConsistentHash in interface DistributionManagernewCH - consistent hash to set topublic boolean isAffectedByRehash(Object key)
DistributionManagerisAffectedByRehash in interface DistributionManagerkey - key to testpublic boolean isRehashInProgress()
isRehashInProgress in interface DistributionManagerpublic boolean isJoinComplete()
DistributionManagerisJoinComplete in interface DistributionManagerpublic Collection<Address> getAffectedNodes(Collection<Object> affectedKeys)
DistributionManagerDistributionManager.locateAll(java.util.Collection) and then combine the result addresses.getAffectedNodes in interface DistributionManageraffectedKeys - keys to locatepublic boolean isLocatedLocally(String key)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.