Package org.jgroups.blocks
Class PartitionedHashMap.ConsistentHashFunction<K>
java.lang.Object
org.jgroups.blocks.MembershipListenerAdapter
org.jgroups.blocks.PartitionedHashMap.ConsistentHashFunction<K>
- All Implemented Interfaces:
PartitionedHashMap.HashFunction<K>,MembershipListener
- Enclosing class:
PartitionedHashMap<K,V>
public static class PartitionedHashMap.ConsistentHashFunction<K>
extends MembershipListenerAdapter
implements PartitionedHashMap.HashFunction<K>
-
Field Summary
Fields inherited from class org.jgroups.blocks.MembershipListenerAdapter
membershipListeners, membershipListenersCache -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.jgroups.blocks.MembershipListenerAdapter
addMembershipListener, block, removeMembershipListener, suspect, unblock
-
Constructor Details
-
ConsistentHashFunction
public ConsistentHashFunction()
-
-
Method Details
-
hash
Description copied from interface:PartitionedHashMap.HashFunctionDefines 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.- Specified by:
hashin interfacePartitionedHashMap.HashFunction<K>- Parameters:
key- The object to be hashedmembers- 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:
-
viewAccepted
Description copied from class:MembershipListenerAdapterNotify membership listener that new view was accepted. This method in turn passes new view to all registered membership listeners.- Specified by:
viewAcceptedin interfaceMembershipListener- Overrides:
viewAcceptedin classMembershipListenerAdapter
-