Package org.infinispan.util
Class StripedHashFunction<T>
java.lang.Object
org.infinispan.util.StripedHashFunction<T>
An hash function for stripping.
It calculates the number of segments based on the concurrency level desired and hashes the object to the corresponding segments.
- Since:
- 8.0
- Author:
- Pedro Ruivo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal int
final int
hashToSegment
(T object) It calculates the segment in which the object belongs.
-
Constructor Details
-
StripedHashFunction
public StripedHashFunction(int concurrencyLevel)
-
-
Method Details
-
getNumSegments
public final int getNumSegments()- Returns:
- the number of segments.
-
hashToSegment
It calculates the segment in which the object belongs.- Parameters:
object
- the object to hash.- Returns:
- the segment index, between 0 and
getNumSegments()
-1.
-