|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.routing.ConsistentHash<T>
public class ConsistentHash<T>
Consistent Hashing node ring implementation.
A good explanation of Consistent Hashing: http://weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html
Note that toString of the ring nodes are used for the node hash, i.e. make sure it is different for different nodes.
Method Summary | ||
---|---|---|
ConsistentHash<T> |
add(T node)
Java API: Adds a node to the node ring. |
|
static
|
apply(scala.collection.Iterable<T> nodes,
int virtualNodesFactor,
scala.reflect.ClassTag<T> evidence$2)
|
|
static
|
create(java.lang.Iterable<T> nodes,
int virtualNodesFactor)
Java API: Factory method to create a ConsistentHash |
|
boolean |
isEmpty()
Is the node ring empty, i.e. |
|
T |
nodeFor(byte[] key)
Get the node responsible for the data key. |
|
T |
nodeFor(java.lang.String key)
Get the node responsible for the data key. |
|
ConsistentHash<T> |
remove(T node)
Java API: Removes a node from the node ring. |
|
int |
virtualNodesFactor()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> ConsistentHash<T> apply(scala.collection.Iterable<T> nodes, int virtualNodesFactor, scala.reflect.ClassTag<T> evidence$2)
public static <T> ConsistentHash<T> create(java.lang.Iterable<T> nodes, int virtualNodesFactor)
nodes
- (undocumented)virtualNodesFactor
- (undocumented)
public int virtualNodesFactor()
public ConsistentHash<T> add(T node)
node
- (undocumented)
public ConsistentHash<T> remove(T node)
node
- (undocumented)
public T nodeFor(byte[] key)
IllegalStateException
key
- (undocumented)
public T nodeFor(java.lang.String key)
IllegalStateException
key
- (undocumented)
public boolean isEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |