Class HashFunctionPartitioner
java.lang.Object
org.infinispan.distribution.ch.impl.HashFunctionPartitioner
- All Implemented Interfaces:
ToIntFunction<Object>
,Matchable<KeyPartitioner>
,KeyPartitioner
- Direct Known Subclasses:
AffinityPartitioner
,RESPHashFunctionPartitioner
Key partitioner that computes a key's segment based on a hash function.
- Since:
- 8.2
- Author:
- Dan Berindei
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
boolean
getHash()
int
getHashForKey
(Object key) int
getSegment
(Object key) Obtains the segment for a key.int
getSegmentForHash
(int hash) int
hashCode()
protected void
init
(int numSegments) void
init
(HashConfiguration configuration) Initialization.void
init
(KeyPartitioner other) static HashFunctionPartitioner
instance
(int numSegments) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.infinispan.distribution.ch.KeyPartitioner
applyAsInt, matches
-
Field Details
-
hashFunction
-
numSegments
protected int numSegments
-
-
Constructor Details
-
HashFunctionPartitioner
public HashFunctionPartitioner() -
HashFunctionPartitioner
public HashFunctionPartitioner(int numSegments)
-
-
Method Details
-
instance
-
init
Description copied from interface:KeyPartitioner
Initialization.The partitioner can also use injection to access other cache-level or global components. This method will be called before any other injection methods.
Does not need to be thread-safe (Infinispan safely publishes the instance after initialization).
- Specified by:
init
in interfaceKeyPartitioner
- Parameters:
configuration
-
-
init
- Specified by:
init
in interfaceKeyPartitioner
-
init
protected void init(int numSegments) -
bitsToUse
protected int bitsToUse() -
getSegment
Description copied from interface:KeyPartitioner
Obtains the segment for a key. Must be thread-safe.- Specified by:
getSegment
in interfaceKeyPartitioner
-
getHashForKey
-
getSegmentForHash
public int getSegmentForHash(int hash) -
getHash
-
equals
-
hashCode
public int hashCode() -
toString
-