Package org.jgroups.blocks
Class PartitionedHashMap.ArrayBasedConsistentHashFunction<K>
java.lang.Object
org.jgroups.blocks.MembershipListenerAdapter
org.jgroups.blocks.PartitionedHashMap.ArrayBasedConsistentHashFunction<K>
- All Implemented Interfaces:
PartitionedHashMap.HashFunction<K>,MembershipListener
- Enclosing class:
PartitionedHashMap<K,V>
public static class PartitionedHashMap.ArrayBasedConsistentHashFunction<K>
extends MembershipListenerAdapter
implements PartitionedHashMap.HashFunction<K>
Uses arrays to store hash values of addresses, plus addresses.
-
Field Summary
Fields inherited from class org.jgroups.blocks.MembershipListenerAdapter
membershipListeners, membershipListenersCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidblock()Notify membership listeners to temporarily stop sending messages into a channel.Defines a hash function to pick the right node from the list of cluster nodes.voidNotify membership listener that some node was suspected.voidviewAccepted(View new_view) Notify membership listener that new view was accepted.Methods inherited from class org.jgroups.blocks.MembershipListenerAdapter
addMembershipListener, removeMembershipListener, unblock
-
Constructor Details
-
ArrayBasedConsistentHashFunction
public ArrayBasedConsistentHashFunction()
-
-
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
-
suspect
Description copied from class:MembershipListenerAdapterNotify membership listener that some node was suspected. This method in turn passes suspected member address to all registered membership listeners.- Specified by:
suspectin interfaceMembershipListener- Overrides:
suspectin classMembershipListenerAdapter
-
block
public void block()Description copied from class:MembershipListenerAdapterNotify membership listeners to temporarily stop sending messages into a channel. This method in turn calls same method of all registered membership listener.- Specified by:
blockin interfaceMembershipListener- Overrides:
blockin classMembershipListenerAdapter
-