Class SegmentConsistentHash
- java.lang.Object
-
- org.infinispan.hotrod.impl.consistenthash.SegmentConsistentHash
-
- All Implemented Interfaces:
ConsistentHash
public final class SegmentConsistentHash extends Object implements ConsistentHash
-
-
Field Summary
-
Fields inherited from interface org.infinispan.hotrod.impl.consistenthash.ConsistentHash
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description SegmentConsistentHash()
-
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.intgetNumSegments()Map<SocketAddress,Set<Integer>>getPrimarySegmentsByServer()intgetSegment(Object key)SocketAddress[][]getSegmentOwners()Map<SocketAddress,Set<Integer>>getSegmentsByServer()SocketAddressgetServer(Object key)voidinit(SocketAddress[][] segmentOwners, int numSegments)voidinit(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
-
-
-
Method Detail
-
init
public void init(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
- Specified by:
initin interfaceConsistentHash
-
init
public void init(SocketAddress[][] segmentOwners, int numSegments)
-
getServer
public SocketAddress getServer(Object key)
- Specified by:
getServerin interfaceConsistentHash
-
getSegment
public int getSegment(Object key)
-
getNormalizedHash
public 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
-
getNumSegments
public int getNumSegments()
-
getSegmentOwners
public SocketAddress[][] getSegmentOwners()
-
-