Package org.infinispan.util
Class StripedHashFunction<T>
- java.lang.Object
-
- org.infinispan.util.StripedHashFunction<T>
-
public class StripedHashFunction<T> extends Object
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
Constructors Constructor Description StripedHashFunction(int concurrencyLevel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumSegments()
int
hashToSegment(T object)
It calculates the segment in which the object belongs.
-
-
-
Method Detail
-
getNumSegments
public final int getNumSegments()
- Returns:
- the number of segments.
-
hashToSegment
public final int hashToSegment(T object)
It calculates the segment in which the object belongs.- Parameters:
object
- the object to hash.- Returns:
- the segment index, between 0 and
getNumSegments()
-1.
-
-