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.
Method Summary |
void |
block()
Notify membership listeners to temporarily stop sending messages into
a channel. |
Address |
hash(K key,
java.util.List<Address> members)
Defines a hash function to pick the right node from the list of cluster nodes. |
void |
suspect(Address suspected_mbr)
Notify membership listener that some node was suspected. |
void |
viewAccepted(View new_view)
Notify membership listener that new view was accepted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PartitionedHashMap.ArrayBasedConsistentHashFunction
public PartitionedHashMap.ArrayBasedConsistentHashFunction()
hash
public Address hash(K key,
java.util.List<Address> members)
- Description copied from interface:
PartitionedHashMap.HashFunction
- 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.
- Specified by:
hash
in interface PartitionedHashMap.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
public void viewAccepted(View new_view)
- Description copied from class:
MembershipListenerAdapter
- Notify membership listener that new view was accepted. This method in
turn passes new view to all registered membership listeners.
- Specified by:
viewAccepted
in interface MembershipListener
- Overrides:
viewAccepted
in class MembershipListenerAdapter
suspect
public void suspect(Address suspected_mbr)
- Description copied from class:
MembershipListenerAdapter
- Notify membership listener that some node was suspected. This method
in turn passes suspected member address to all registered membership
listeners.
- Specified by:
suspect
in interface MembershipListener
- Overrides:
suspect
in class MembershipListenerAdapter
block
public void block()
- Description copied from class:
MembershipListenerAdapter
- Notify membership listeners to temporarily stop sending messages into
a channel. This method in turn calls same method of all registered
membership listener.
- Specified by:
block
in interface MembershipListener
- Overrides:
block
in class MembershipListenerAdapter
Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.