org.infinispan.distribution
Class DistributionManagerImpl

java.lang.Object
  extended by org.infinispan.distribution.DistributionManagerImpl
All Implemented Interfaces:
DistributionManager

public class DistributionManagerImpl
extends Object
implements DistributionManager

The default distribution manager implementation

Since:
4.0
Author:
Manik Surtani

Nested Class Summary
 class DistributionManagerImpl.ViewChangeListener
           
 
Constructor Summary
DistributionManagerImpl()
           
 
Method Summary
 void applyReceivedState(Map<Object,InternalCacheValue> state)
           
 void applyState(ConsistentHash consistentHash, Map<Object,InternalCacheValue> state)
           
 CacheStore getCacheStoreForRehashing()
          Retrieves a cache store if one is available and set up for use in rehashing.
 String getClusterSize()
           
 ConsistentHash getConsistentHash()
           
 TransactionLogger getTransactionLogger()
           
 void informRehashOnJoin(Address joiner, boolean starting)
          This will cause all nodes to add the joiner to their UnionCH
 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 isLocal(Object key)
           
 boolean isLocatedLocally(String key)
           
 boolean isRehashInProgress()
           
 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)
           
 void start()
           
 void stop()
           
 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, toString, wait, wait, wait
 

Constructor Detail

DistributionManagerImpl

public DistributionManagerImpl()
Method Detail

init

public void init(Configuration configuration,
                 RpcManager rpcManager,
                 CacheManagerNotifier notifier,
                 CommandsFactory cf,
                 DataContainer dataContainer,
                 InterceptorChain interceptorChain,
                 InvocationContextContainer icc,
                 CacheLoaderManager cacheLoaderManager)

start

public void start()
           throws Exception
Throws:
Exception

stop

public void stop()

rehash

public void rehash(List<Address> newMembers,
                   List<Address> oldMembers)

isLocal

public boolean isLocal(Object key)
Specified by:
isLocal in interface DistributionManager

locate

public List<Address> locate(Object key)
Description copied from interface: DistributionManager
Locates a key in a cluster. 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.

Specified by:
locate in interface DistributionManager
Parameters:
key - key to test
Returns:
a list of addresses where the key may reside

locateAll

public Map<Object,List<Address>> locateAll(Collection<Object> keys)
Description copied from interface: DistributionManager
Locates a list of keys in a cluster. Like 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.

Specified by:
locateAll in interface DistributionManager
Parameters:
keys - list of keys to test
Returns:
a list of addresses where the key may reside

transformForL1

public void transformForL1(CacheEntry entry)
Description copied from interface: DistributionManager
Transforms a cache entry so it is marked for L1 rather than the primary cache data structure.

Specified by:
transformForL1 in interface DistributionManager
Parameters:
entry - entry to transform

retrieveFromRemoteSource

public InternalCacheEntry retrieveFromRemoteSource(Object key)
                                            throws Exception
Description copied from interface: DistributionManager
Retrieves a cache entry from a remote source

Specified by:
retrieveFromRemoteSource in interface DistributionManager
Parameters:
key - key to look up
Returns:
an internal cache entry, or null if it cannot be located
Throws:
Exception

getConsistentHash

public ConsistentHash getConsistentHash()
Specified by:
getConsistentHash in interface DistributionManager

setConsistentHash

public void setConsistentHash(ConsistentHash consistentHash)
Specified by:
setConsistentHash in interface DistributionManager

isAffectedByRehash

public boolean isAffectedByRehash(Object key)
Description copied from interface: DistributionManager
Tests whether a given key is affected by a rehash that may be in progress.

Specified by:
isAffectedByRehash in interface DistributionManager
Parameters:
key - key to test
Returns:
whether a key is affected by a rehash

getTransactionLogger

public TransactionLogger getTransactionLogger()
Specified by:
getTransactionLogger in interface DistributionManager

requestPermissionToJoin

public List<Address> requestPermissionToJoin(Address joiner)
Description copied from interface: DistributionManager
"Asks" a coordinator if a joiner may join. Used to serialize joins such that only a single joiner comes in at any given time.

Specified by:
requestPermissionToJoin in interface DistributionManager
Parameters:
joiner - joiner who wants to join
Returns:
a consistent hash prior to the joiner joining (if the joiner is allowed to join), otherwise null.

notifyJoinComplete

public void notifyJoinComplete(Address joiner)
Description copied from interface: DistributionManager
Notifies a coordinator when a join completes

Specified by:
notifyJoinComplete in interface DistributionManager
Parameters:
joiner - joiner who has completed.

informRehashOnJoin

public void informRehashOnJoin(Address joiner,
                               boolean starting)
Description copied from interface: DistributionManager
This will cause all nodes to add the joiner to their UnionCH

Specified by:
informRehashOnJoin in interface DistributionManager

applyState

public void applyState(ConsistentHash consistentHash,
                       Map<Object,InternalCacheValue> state)

getCacheStoreForRehashing

public CacheStore getCacheStoreForRehashing()
Description copied from interface: DistributionManager
Retrieves a cache store if one is available and set up for use in rehashing. May return null!

Specified by:
getCacheStoreForRehashing in interface DistributionManager
Returns:
a cache store is one is available and configured for use in rehashing, or null otherwise.

isRehashInProgress

public boolean isRehashInProgress()
Specified by:
isRehashInProgress in interface DistributionManager

applyReceivedState

public void applyReceivedState(Map<Object,InternalCacheValue> state)
Specified by:
applyReceivedState in interface DistributionManager

getClusterSize

public String getClusterSize()

isLocatedLocally

public boolean isLocatedLocally(String key)

locateKey

public List<String> locateKey(String key)

Google Analytics

Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.