|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.infinispan.distribution.DistributionManagerImpl
public class DistributionManagerImpl
The default distribution manager implementation
Nested Class Summary | |
---|---|
class |
DistributionManagerImpl.ViewChangeListener
|
Constructor Summary | |
---|---|
DistributionManagerImpl()
|
Method Summary | |
---|---|
void |
applyReceivedState(Map<Object,InternalCacheValue> state)
Applies a state map received via a RehashControlCommand. |
void |
applyRemoteTxLog(List<WriteCommand> txLogCommands)
Applies an ordered list of modifications to the current node. |
void |
applyState(ConsistentHash consistentHash,
Map<Object,InternalCacheValue> state)
|
List<Address> |
getAffectedNodes(Set<Object> affectedKeys)
A helper method that retrieves a list of nodes affected by operations on a set of keys. |
CacheStore |
getCacheStoreForRehashing()
Retrieves a cache store if one is available and set up for use in rehashing. |
ConsistentHash |
getConsistentHash()
Retrieves the consistent hash instance currently in use, which may be an instance of the configured ConsistentHash instance (which defaults to DefaultConsistentHash , or an instance of
UnionConsistentHash if a rehash is in progress. |
TransactionLogger |
getTransactionLogger()
Retrieves the transaction logger instance associated with this DistributionManager |
void |
informRehashOnJoin(Address joiner,
boolean starting)
This will cause all nodes to add the joiner to their consistent hash instance (usually by creating a UnionConsistentHash |
void |
init(Configuration configuration,
RpcManager rpcManager,
CacheManagerNotifier notifier,
CommandsFactory cf,
DataContainer dataContainer,
InterceptorChain interceptorChain,
InvocationContextContainer icc,
CacheLoaderManager cacheLoaderManager)
|
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)
|
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. |
List<String> |
locateKey(String key)
|
void |
notifyJoinComplete(Address joiner)
Notifies a coordinator when a join completes |
void |
rehash(List<Address> newMembers,
List<Address> oldMembers)
|
List<Address> |
requestPermissionToJoin(Address joiner)
"Asks" a coordinator if a joiner may join. |
InternalCacheEntry |
retrieveFromRemoteSource(Object key)
Retrieves a cache entry from a remote source. |
void |
setConsistentHash(ConsistentHash consistentHash)
Sets the consistent hash implementation in use. |
void |
start()
|
void |
stop()
|
String |
toString()
|
void |
transformForL1(CacheEntry entry)
Transforms a cache entry so it is marked for L1 rather than the primary cache data structure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DistributionManagerImpl()
Method Detail |
---|
public void init(Configuration configuration, RpcManager rpcManager, CacheManagerNotifier notifier, CommandsFactory cf, DataContainer dataContainer, InterceptorChain interceptorChain, InvocationContextContainer icc, CacheLoaderManager cacheLoaderManager)
public void start() throws Exception
Exception
public void stop()
public void rehash(List<Address> newMembers, List<Address> oldMembers)
public boolean isLocal(Object key)
isLocal
in interface DistributionManager
public List<Address> locate(Object key)
DistributionManager
locate
in interface DistributionManager
key
- key to test
public Map<Object,List<Address>> locateAll(Collection<Object> keys)
DistributionManager
DistributionManager.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 DistributionManager
keys
- list of keys to test
public void transformForL1(CacheEntry entry)
DistributionManager
transformForL1
in interface DistributionManager
entry
- entry to transformpublic InternalCacheEntry retrieveFromRemoteSource(Object key) throws Exception
DistributionManager
ClusteredGetCommand
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 DistributionManager
key
- key to look up
Exception
- if something bad happenspublic ConsistentHash getConsistentHash()
DistributionManager
DefaultConsistentHash
, or an instance of
UnionConsistentHash
if a rehash is in progress.
getConsistentHash
in interface DistributionManager
public void setConsistentHash(ConsistentHash consistentHash)
DistributionManager
setConsistentHash
in interface DistributionManager
consistentHash
- consistent hash to set topublic boolean isAffectedByRehash(Object key)
DistributionManager
isAffectedByRehash
in interface DistributionManager
key
- key to test
public TransactionLogger getTransactionLogger()
DistributionManager
getTransactionLogger
in interface DistributionManager
public List<Address> requestPermissionToJoin(Address joiner)
DistributionManager
requestPermissionToJoin
in interface DistributionManager
joiner
- joiner who wants to join
public void notifyJoinComplete(Address joiner)
DistributionManager
notifyJoinComplete
in interface DistributionManager
joiner
- joiner who has completed.public void informRehashOnJoin(Address joiner, boolean starting)
DistributionManager
UnionConsistentHash
informRehashOnJoin
in interface DistributionManager
joiner
- address of joinerstarting
- if true, the joiner is reporting that it is starting the join process. If false, the joiner is
reporting that it has completed the join process.public void applyState(ConsistentHash consistentHash, Map<Object,InternalCacheValue> state)
public CacheStore getCacheStoreForRehashing()
DistributionManager
getCacheStoreForRehashing
in interface DistributionManager
public boolean isRehashInProgress()
DistributionManager
isRehashInProgress
in interface DistributionManager
public void applyReceivedState(Map<Object,InternalCacheValue> state)
DistributionManager
applyReceivedState
in interface DistributionManager
state
- state to applypublic boolean isJoinComplete()
DistributionManager
isJoinComplete
in interface DistributionManager
public List<Address> getAffectedNodes(Set<Object> affectedKeys)
DistributionManager
DistributionManager.locateAll(java.util.Collection)
and then combine the result addresses.
getAffectedNodes
in interface DistributionManager
affectedKeys
- keys to locate
public void applyRemoteTxLog(List<WriteCommand> txLogCommands)
DistributionManager
applyRemoteTxLog
in interface DistributionManager
txLogCommands
- ordered list of modspublic boolean isLocatedLocally(String key)
public List<String> locateKey(String key)
public String toString()
toString
in class Object
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |