| 构造器和说明 |
|---|
ConsistentHash(HashFunction hashFunction,
int numberOfReplicas,
Collection<T> nodes)
Instantiates a new Consistent hash.
|
ConsistentHash(int numberOfReplicas,
Collection<T> nodes)
Instantiates a new Consistent hash.
|
| 限定符和类型 | 方法和说明 |
|---|---|
T |
getNodeFor(Object key)
This returns the closest node for the object.
|
List<T> |
getNUniqueNodesFor(Object key,
int n)
This returns the closest n unique nodes in order for the object.
|
List<T> |
getNUniqueNodesFor(Object key,
int n,
List<String> disasterList)
This returns the closest n unique nodes in order for the object.
|
public ConsistentHash(int numberOfReplicas,
Collection<T> nodes)
numberOfReplicas - the number of replicasnodes - the nodespublic ConsistentHash(HashFunction hashFunction, int numberOfReplicas, Collection<T> nodes)
hashFunction - the hash functionnumberOfReplicas - the number of replicasnodes - the nodespublic T getNodeFor(Object key)
key - the keypublic List<T> getNUniqueNodesFor(Object key, int n)
key - the keyn - the npublic List<T> getNUniqueNodesFor(Object key, int n, List<String> disasterList)
key - the keyn - the ndisasterList - disaster region nameCopyright © 2020 The Ant Financial. All rights reserved.