public class ConsistentHashV2 extends Object implements ConsistentHash
MurmurHash3
Constructor and Description |
---|
ConsistentHashV2() |
ConsistentHashV2(Random rnd) |
Modifier and Type | Method and Description |
---|---|
int |
getNormalizedHash(Object object)
Computes hash code of a given object, and then normalizes it to ensure a positive
value is always returned.
|
Map<SocketAddress,Set<Integer>> |
getPrimarySegmentsByServer() |
Map<SocketAddress,Set<Integer>> |
getSegmentsByServer() |
SocketAddress |
getServer(Object key) |
void |
init(Map<SocketAddress,Set<Integer>> servers2Hash,
int numKeyOwners,
int hashSpace) |
void |
setHash(Hash hash) |
protected Hash hash
public ConsistentHashV2(Random rnd)
public ConsistentHashV2()
public void init(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
init
in interface ConsistentHash
public SocketAddress getServer(Object key)
getServer
in interface ConsistentHash
public void setHash(Hash hash)
public final int getNormalizedHash(Object object)
ConsistentHash
getNormalizedHash
in interface ConsistentHash
object
- to hashpublic Map<SocketAddress,Set<Integer>> getSegmentsByServer()
getSegmentsByServer
in interface ConsistentHash
public Map<SocketAddress,Set<Integer>> getPrimarySegmentsByServer()
getPrimarySegmentsByServer
in interface ConsistentHash
Copyright © 2021 JBoss by Red Hat. All rights reserved.