org.infinispan.distribution.ch
Class DefaultConsistentHash

java.lang.Object
  extended by org.infinispan.distribution.ch.AbstractConsistentHash
      extended by org.infinispan.distribution.ch.AbstractWheelConsistentHash
          extended by org.infinispan.distribution.ch.DefaultConsistentHash
All Implemented Interfaces:
ConsistentHash

public class DefaultConsistentHash
extends AbstractWheelConsistentHash


Nested Class Summary
static class DefaultConsistentHash.Externalizer
           
 
Field Summary
 
Fields inherited from class org.infinispan.distribution.ch.AbstractWheelConsistentHash
caches, hashFunction, numVirtualNodes, positionKeys, positionValues, trace
 
Fields inherited from class org.infinispan.distribution.ch.AbstractConsistentHash
groupManager
 
Constructor Summary
DefaultConsistentHash()
           
DefaultConsistentHash(Hash hash)
           
 
Method Summary
 boolean equals(Object o)
           
protected  Log getLog()
           
 int hashCode()
           
 boolean isKeyLocalToAddress(Address target, Object key, int replCount)
          Test to see whether a key is mapped to a given address.
 List<Address> locate(Object key, int replCount)
          Locates a key, given a replication count (number of copies).
 
Methods inherited from class org.infinispan.distribution.ch.AbstractWheelConsistentHash
getCaches, getHashIds, getNormalizedHash, getPositionIndex, getPositionsIterator, isVirtualNodesEnabled, primaryLocation, setCaches, setHashFunction, setNumVirtualNodes, toString
 
Methods inherited from class org.infinispan.distribution.ch.AbstractConsistentHash
getBackupsForNode, getGrouping, getStateProvidersOnJoin, getStateProvidersOnLeave, locateAll, setGroupManager
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultConsistentHash

public DefaultConsistentHash()

DefaultConsistentHash

public DefaultConsistentHash(Hash hash)
Method Detail

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 locate
replCount - 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 test
key - key to test
replCount - repl count
Returns:
true if the key is mapped to the address; false otherwise

getLog

protected Log getLog()
Overrides:
getLog in class AbstractWheelConsistentHash

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.