|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.distribution.AbstractConsistentHash
org.infinispan.distribution.ExperimentalDefaultConsistentHash
public class ExperimentalDefaultConsistentHash
Consistent hashing algorithm. Each target is entered into the pool weight[i]*weightFactor times. Where weight[i] and weightFactor are integers greater than zero.
Based on akluge's impl on http://www.vizitsolutions.com/ConsistentHashingCaching.html
Nested Class Summary | |
---|---|
static class |
ExperimentalDefaultConsistentHash.Entry
An entry into a consistent hash. |
static class |
ExperimentalDefaultConsistentHash.Externalizer
|
Constructor Summary | |
---|---|
ExperimentalDefaultConsistentHash()
|
Method Summary | |
---|---|
boolean |
equals(Object other)
|
List<Address> |
getCaches()
Should return a collection of cache addresses in the cluster. |
int |
getDistance(Address a1,
Address a2)
The distance between the first entries in the address array for two caches, a1 and a2. |
int |
hashCode()
|
boolean |
isAdjacent(Address a1,
Address a2)
Two hashes are adjacent if they are next to each other in the consistent hash. |
List<Address> |
locate(Object key,
int replCount)
Locates a key, given a replication count (number of copies). |
void |
setCaches(List<Address> caches)
Sets the collection of cache addresses in the cluster. |
String |
toString()
|
Methods inherited from class org.infinispan.distribution.AbstractConsistentHash |
---|
isKeyLocalToAddress, locateAll |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ExperimentalDefaultConsistentHash()
Method Detail |
---|
public List<Address> getCaches()
ConsistentHash
public void setCaches(List<Address> caches)
ConsistentHash
caches
- caches in cluster.public int getDistance(Address a1, Address a2)
a1
- The address of the first cache.a2
- The address of the second cache.
public boolean isAdjacent(Address a1, Address a2)
a1
- The address of the first cache.a2
- The address of the second cache.
public List<Address> locate(Object key, int replCount)
ConsistentHash
key
- key to locatereplCount
- replication count (number of copies)
ConsistentHash.setCaches(java.util.List)
. Should never be null, and should contain replCount elements or the max
number of caches available, whichever is smaller.public String toString()
toString
in class Object
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |