Class ConsistentHashV2
- java.lang.Object
-
- org.infinispan.hotrod.impl.consistenthash.ConsistentHashV2
-
- All Implemented Interfaces:
ConsistentHash
public class ConsistentHashV2 extends Object implements ConsistentHash
Version 2 of the ConsistentHash function. Uses MurmurHash3.- Since:
- 14.0
- See Also:
MurmurHash3
-
-
Field Summary
Fields Modifier and Type Field Description protected org.infinispan.commons.hash.Hashhash-
Fields inherited from interface org.infinispan.hotrod.impl.consistenthash.ConsistentHash
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description ConsistentHashV2(Random rnd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNormalizedHash(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()SocketAddressgetServer(Object key)voidinit(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)voidsetHash(org.infinispan.commons.hash.Hash hash)
-
-
-
Constructor Detail
-
ConsistentHashV2
public ConsistentHashV2(Random rnd)
-
-
Method Detail
-
init
public void init(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
- Specified by:
initin interfaceConsistentHash
-
getServer
public SocketAddress getServer(Object key)
- Specified by:
getServerin interfaceConsistentHash
-
setHash
public void setHash(org.infinispan.commons.hash.Hash hash)
-
getNormalizedHash
public final int getNormalizedHash(Object object)
Description copied from interface:ConsistentHashComputes hash code of a given object, and then normalizes it to ensure a positive value is always returned.- Specified by:
getNormalizedHashin interfaceConsistentHash- Parameters:
object- to hash- Returns:
- a non-null, non-negative normalized hash code for a given object
-
getSegmentsByServer
public Map<SocketAddress,Set<Integer>> getSegmentsByServer()
- Specified by:
getSegmentsByServerin interfaceConsistentHash
-
getPrimarySegmentsByServer
public Map<SocketAddress,Set<Integer>> getPrimarySegmentsByServer()
- Specified by:
getPrimarySegmentsByServerin interfaceConsistentHash
-
-