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.
- 参数:
key
- The object to be hashedmembership
- 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(MembershipListener)
)
- 返回: