Permalink
Browse files

Merge remote branch 'origin/master' into bdb40

* origin/master:
  Use abs instead of Math.abs to avoid issue when hash returns Integer.MIN_VALUE.
  • Loading branch information...
2 parents 3b6de90 + 0dfb70b commit 3ae51a0127aca8800ac8f27544cd2baa38d86464 @ijuma ijuma committed Feb 3, 2010
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/java/voldemort/routing/ConsistentRoutingStrategy.java
@@ -80,7 +80,6 @@ public ConsistentRoutingStrategy(HashFunction hash, Collection<Node> nodes, int
* Math.abs returns Integer.MIN_VALUE if a == Integer.MIN_VALUE and this
* method returns Integer.MAX_VALUE in that case.
*/
- @SuppressWarnings("unused")
private static int abs(int a) {
if(a >= 0)
return a;
@@ -149,7 +148,7 @@ Node getNodeByPartition(int partition) {
}
public List<Integer> getPartitionList(byte[] key) {
- int index = Math.abs(hash.hash(key)) % (Math.max(1, this.partitionToNode.length));
+ int index = abs(hash.hash(key)) % (Math.max(1, this.partitionToNode.length));
return getReplicatingPartitionList(index);
}
}

0 comments on commit 3ae51a0

Please sign in to comment.