Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.client.hotrod.impl.consistenthash
Class ConsistentHashV1

java.lang.Object
  extended by org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV1
All Implemented Interfaces:
ConsistentHash
Direct Known Subclasses:
ConsistentHashV2

public class ConsistentHashV1
extends Object
implements ConsistentHash

Version one consistent hash function based on MurmurHash2;

Since:
4.1
Author:
Mircea.Markus@jboss.com

Field Summary
protected  Hash hash
           
 
Constructor Summary
ConsistentHashV1()
           
ConsistentHashV1(Random rnd)
           
 
Method Summary
 int getNormalizedHash(Object object)
          Computes hash code of a given object, and then normalizes it to ensure a positive value is always returned.
 SocketAddress getServer(byte[] key)
           
 void init(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
           
 void setHash(Hash hash)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hash

protected Hash hash
Constructor Detail

ConsistentHashV1

public ConsistentHashV1(Random rnd)

ConsistentHashV1

public ConsistentHashV1()
Method Detail

init

public void init(Map<SocketAddress,Set<Integer>> servers2Hash,
                 int numKeyOwners,
                 int hashSpace)
Specified by:
init in interface ConsistentHash

getServer

public SocketAddress getServer(byte[] key)
Specified by:
getServer in interface ConsistentHash

setHash

public void setHash(Hash hash)

getNormalizedHash

public final int getNormalizedHash(Object object)
Description copied from interface: ConsistentHash
Computes hash code of a given object, and then normalizes it to ensure a positive value is always returned.

Specified by:
getNormalizedHash in interface ConsistentHash
Parameters:
object - to hash
Returns:
a non-null, non-negative normalized hash code for a given object

Infinispan Distribution 5.2.6.Final-redhat-2

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