org.infinispan.distribution.ch
Class DefaultConsistentHash
java.lang.Object
org.infinispan.distribution.ch.AbstractConsistentHash
org.infinispan.distribution.ch.AbstractWheelConsistentHash
org.infinispan.distribution.ch.DefaultConsistentHash
- All Implemented Interfaces:
- ConsistentHash
public class DefaultConsistentHash
- extends AbstractWheelConsistentHash
DefaultConsistentHash
public DefaultConsistentHash()
DefaultConsistentHash
public DefaultConsistentHash(Hash hash)
locate
public List<Address> locate(Object key,
int replCount)
- Description copied from interface:
ConsistentHash
- Locates a key, given a replication count (number of copies).
- Parameters:
key - key to locatereplCount - replication count (number of copies)
- Returns:
- a list of addresses where the key resides, where this list is a subset of the addresses set in
ConsistentHash.setCaches(java.util.Set). Should never be null, and should contain replCount elements or the max
number of caches available, whichever is smaller.
isKeyLocalToAddress
public boolean isKeyLocalToAddress(Address target,
Object key,
int replCount)
- Description copied from interface:
ConsistentHash
- Test to see whether a key is mapped to a given address.
- Specified by:
isKeyLocalToAddress in interface ConsistentHash- Overrides:
isKeyLocalToAddress in class AbstractConsistentHash
- Parameters:
target - address to testkey - key to testreplCount - repl count
- Returns:
- true if the key is mapped to the address; false otherwise
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.