Interface PartitionedHashMap.HashFunction<K>

All Known Implementing Classes:
PartitionedHashMap.ArrayBasedConsistentHashFunction, PartitionedHashMap.ConsistentHashFunction
Enclosing class:
PartitionedHashMap<K,V>

public static interface PartitionedHashMap.HashFunction<K>
  • Method Summary

    Modifier and Type
    Method
    Description
    hash(K key, List<Address> membership)
    Defines a hash function to pick the right node from the list of cluster nodes.
  • Method Details

    • hash

      Address hash(K key, List<Address> membership)
      Defines a hash function to pick the right node from the list of cluster nodes. Ideally, this function uses consistent hashing, so that the same key maps to the same node despite cluster view changes. If a view change causes all keys to hash to different nodes, then PartitionedHashMap will redirect requests to different nodes and this causes unnecessary overhead.
      Parameters:
      key - The object to be hashed
      membership - The membership. This value can be ignored for example if the hash function keeps track of the membership itself, e.g. by registering as a membership listener (PartitionedHashMap.addMembershipListener(org.jgroups.MembershipListener) )
      Returns: