Interface PartitionedHashMap.HashFunction<K>

    • Method Detail

      • hash

        Address hash​(K key,
                     java.util.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: