Class HashFunctionPartitioner

java.lang.Object
org.infinispan.distribution.ch.impl.HashFunctionPartitioner
All Implemented Interfaces:
Cloneable, ToIntFunction<Object>, Matchable<KeyPartitioner>, KeyPartitioner
Direct Known Subclasses:
AffinityPartitioner

public class HashFunctionPartitioner extends Object implements KeyPartitioner, Cloneable
Key partitioner that computes a key's segment based on a hash function.
Since:
8.2
Author:
Dan Berindei
  • Constructor Details

    • HashFunctionPartitioner

      public HashFunctionPartitioner()
    • HashFunctionPartitioner

      public HashFunctionPartitioner(int numSegments)
  • Method Details

    • init

      public void init(HashConfiguration configuration)
      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 interface KeyPartitioner
    • init

      public void init(KeyPartitioner other)
      Specified by:
      init in interface KeyPartitioner
    • getSegment

      public int getSegment(Object key)
      Description copied from interface: KeyPartitioner
      Obtains the segment for a key. Must be thread-safe.
      Specified by:
      getSegment in interface KeyPartitioner
    • getHash

      public Hash getHash()
    • getSegmentEndHashes

      public List<Integer> getSegmentEndHashes()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object