org.jgroups.blocks
Interface PartitionedHashMap.HashFunction<K>

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

public static interface PartitionedHashMap.HashFunction<K>


Method Summary
 Address hash(K key, java.util.List<Address> membership)
          Defines a hash function to pick the right node from the list of cluster nodes.
 

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:


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.