[infinispan-dev] Hash calculation in DefaultConsistentHash

Mircea Markus mircea.markus at jboss.com
Tue Sep 15 03:55:16 EDT 2009


Thanks for rising this!
I've just run the findbugs and found the same issue, it will be sorted  
out before next Beta.

On Sep 14, 2009, at 12:25 PM, Krzysztof Sobolewski wrote:

> I took a look at the implementation of DefaultConsistentHash and I was
> wondering: does the key hash value have to be positive? As in:
>
>      int hash = Math.abs(key.hashCode());
>
> I can see that the resulting hash is used to pull a tail map of the  
> hash
> space, but there's no reason the SortedMap key has to be positive. I'm
> actually most concerned about the fact that  
> Math.abs(Integer.MIN_VALUE) ==
> Integer.MIN_VALUE so you have at least one negative key anyway :)
> -KS
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev




More information about the infinispan-dev mailing list