Merge pull request #330 from zhupan/master
Sharded Performance improvement
This commit is contained in:
@@ -77,7 +77,7 @@ public class Sharded<R, S extends ShardInfo<R>> {
|
|||||||
|
|
||||||
public S getShardInfo(byte[] key) {
|
public S getShardInfo(byte[] key) {
|
||||||
SortedMap<Long, S> tail = nodes.tailMap(algo.hash(key));
|
SortedMap<Long, S> tail = nodes.tailMap(algo.hash(key));
|
||||||
if (tail.size() == 0) {
|
if (tail.isEmpty()) {
|
||||||
return nodes.get(nodes.firstKey());
|
return nodes.get(nodes.firstKey());
|
||||||
}
|
}
|
||||||
return tail.get(tail.firstKey());
|
return tail.get(tail.firstKey());
|
||||||
|
|||||||
Reference in New Issue
Block a user