|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.infinispan.distribution.ch.AbstractConsistentHash
public abstract class AbstractConsistentHash
An abstract consistent hash implementation that handles common implementations of certain methods. In particular,
default implementations of locateAll(java.util.Collection, int) and isKeyLocalToAddress(org.infinispan.remoting.transport.Address, Object, int).
ConsistentHash.locate(Object, int) first (and
sometimes in a loop). Depending on the algorithm used, there may be more efficient ways to achieve the same results
and in such cases the methods provided here should be overridden.
| Field Summary | |
|---|---|
protected Set<Address> |
caches
|
protected TopologyInfo |
topologyInfo
|
| Constructor Summary | |
|---|---|
AbstractConsistentHash()
|
|
| Method Summary | |
|---|---|
Set<Address> |
getCaches()
Should return a collection of cache addresses in the cluster. |
TopologyInfo |
getTopologyInfo()
|
boolean |
isKeyLocalToAddress(Address a,
Object key,
int replCount)
Test to see whether a key is mapped to a given address. |
Map<Object,List<Address>> |
locateAll(Collection<Object> keys,
int replCount)
The logical equivalent of calling ConsistentHash.locate(Object, int) multiple times for each key in the collection of
keys. |
void |
setCaches(Set<Address> caches)
Sets the collection of cache addresses in the cluster. |
void |
setTopologyInfo(TopologyInfo topologyInfo)
Sets cluster topology information that can be used by CH to improve fault tolerance by smart choosing of backups. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.infinispan.distribution.ch.ConsistentHash |
|---|
getBackupsForNode, getHashId, getHashSpace, getStateProvidersOnJoin, getStateProvidersOnLeave, locate |
| Field Detail |
|---|
protected volatile Set<Address> caches
protected TopologyInfo topologyInfo
| Constructor Detail |
|---|
public AbstractConsistentHash()
| Method Detail |
|---|
public void setCaches(Set<Address> caches)
ConsistentHash
setCaches in interface ConsistentHashcaches - A set of unique caches in cluster.public Set<Address> getCaches()
ConsistentHash
getCaches in interface ConsistentHash
public Map<Object,List<Address>> locateAll(Collection<Object> keys,
int replCount)
ConsistentHashConsistentHash.locate(Object, int) multiple times for each key in the collection of
keys. Implementations may be optimised for such a bulk lookup, or may just repeatedly call ConsistentHash.locate(Object,
int).
locateAll in interface ConsistentHashkeys - keys to locatereplCount - replication count (number of copies) for each key
public boolean isKeyLocalToAddress(Address a,
Object key,
int replCount)
ConsistentHash
isKeyLocalToAddress in interface ConsistentHasha - address to testkey - key to testreplCount - repl count
public void setTopologyInfo(TopologyInfo topologyInfo)
ConsistentHash
setTopologyInfo in interface ConsistentHashpublic TopologyInfo getTopologyInfo()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||