|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.distribution.DistributionManagerImpl
public class DistributionManagerImpl
The default distribution manager implementation
Nested Class Summary | |
---|---|
class |
DistributionManagerImpl.ViewChangeListener
|
Constructor Summary | |
---|---|
DistributionManagerImpl()
Default constructor |
Method Summary | |
---|---|
void |
applyRemoteTxLog(List<WriteCommand> commands)
Applies an ordered list of modifications to the current node. |
void |
applyState(ConsistentHash consistentHash,
Map<Object,InternalCacheValue> state,
RemoteTransactionLogger tlog,
boolean forLeave)
|
boolean |
awaitLeaveRehashAcks(Set<Address> stateReceivers,
long timeout)
|
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. |
List<Address> |
getLeavers()
|
DataLocality |
getLocality(Object key)
|
TopologyInfo |
getTopologyInfo()
|
TransactionLogger |
getTransactionLogger()
Retrieves the transaction logger instance associated with this DistributionManager |
NodeTopologyInfo |
informRehashOnJoin(Address a,
boolean starting,
NodeTopologyInfo nodeTopologyInfo)
This will cause all nodes to add the joiner to their consistent hash instance (usually by creating a UnionConsistentHash |
void |
informRehashOnLeave(Address sender)
|
void |
init(Configuration configuration,
RpcManager rpcManager,
CacheManagerNotifier notifier,
CommandsFactory cf,
DataContainer dataContainer,
InterceptorChain interceptorChain,
InvocationContextContainer icc,
CacheLoaderManager cacheLoaderManager,
InboundInvocationHandler inboundInvocationHandler)
|
boolean |
isAffectedByRehash(Object key)
Tests whether a given key is affected by a rehash that may be in progress. |
boolean |
isInFinalJoinPhase()
|
boolean |
isJoinComplete()
Tests whether the current instance has completed joining the cluster |
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)
|
void |
markLeaverAsHandled(Address leaver)
|
void |
rehash(List<Address> newMembers,
List<Address> oldMembers)
|
boolean |
removeLeaver(Address leaver)
|
List<Address> |
requestPermissionToJoin(Address a)
"Asks" a coordinator if a joiner may join. |
InternalCacheEntry |
retrieveFromRemoteSource(Object key,
InvocationContext ctx)
Retrieves a cache entry from a remote source. |
void |
setConsistentHash(ConsistentHash consistentHash)
Sets the consistent hash implementation in use. |
void |
setJoinComplete(boolean joinComplete)
|
void |
setOldConsistentHash(ConsistentHash oldConsistentHash)
|
void |
setRehashInProgress(boolean value)
|
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. |
void |
waitForFinalJoin()
|
void |
waitForJoinToComplete()
|
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, InboundInvocationHandler inboundInvocationHandler)
public void start() throws Exception
Exception
public void waitForJoinToComplete() throws Throwable
Throwable
public void stop()
public void rehash(List<Address> newMembers, List<Address> oldMembers)
public List<Address> getLeavers()
public boolean removeLeaver(Address leaver)
public DataLocality getLocality(Object key)
getLocality
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 Map<Object,List<Address>> locateAll(Collection<Object> keys, int numOwners)
DistributionManager
DistributionManager.locateAll(java.util.Collection)
, but the list of addresses only contains numOwners owners.
locateAll
in interface DistributionManager
public void transformForL1(CacheEntry entry)
DistributionManager
transformForL1
in interface DistributionManager
entry
- entry to transformpublic InternalCacheEntry retrieveFromRemoteSource(Object key, InvocationContext ctx) 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 void setOldConsistentHash(ConsistentHash oldConsistentHash)
public 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 a)
DistributionManager
requestPermissionToJoin
in interface DistributionManager
a
- joiner who wants to join
public NodeTopologyInfo informRehashOnJoin(Address a, boolean starting, NodeTopologyInfo nodeTopologyInfo)
DistributionManager
UnionConsistentHash
informRehashOnJoin
in interface DistributionManager
a
- address of joinerstarting
- if true, the joiner is reporting that it is starting the join process. If false, the joiner ispublic void informRehashOnLeave(Address sender)
informRehashOnLeave
in interface DistributionManager
public void applyState(ConsistentHash consistentHash, Map<Object,InternalCacheValue> state, RemoteTransactionLogger tlog, boolean forLeave)
applyState
in interface DistributionManager
public void setRehashInProgress(boolean value)
setRehashInProgress
in interface DistributionManager
public CacheStore getCacheStoreForRehashing()
DistributionManager
getCacheStoreForRehashing
in interface DistributionManager
public boolean isRehashInProgress()
DistributionManager
isRehashInProgress
in interface DistributionManager
public void markLeaverAsHandled(Address leaver)
public boolean isJoinComplete()
DistributionManager
isJoinComplete
in interface DistributionManager
public void waitForFinalJoin()
waitForFinalJoin
in interface DistributionManager
public boolean isInFinalJoinPhase()
isInFinalJoinPhase
in interface DistributionManager
public void setJoinComplete(boolean joinComplete)
setJoinComplete
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> commands)
DistributionManager
applyRemoteTxLog
in interface DistributionManager
commands
- ordered list of modspublic boolean isLocatedLocally(String key)
public List<String> locateKey(String key)
public String toString()
toString
in class Object
public TopologyInfo getTopologyInfo()
getTopologyInfo
in interface DistributionManager
public boolean awaitLeaveRehashAcks(Set<Address> stateReceivers, long timeout) throws InterruptedException
InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |