use index iteration over iterator

This commit is contained in:
Shay Banon 2011-09-25 22:20:53 +03:00
parent 32526f004c
commit 8658856b48
1 changed files with 5 additions and 2 deletions

View File

@ -194,13 +194,16 @@ public class RoutingNodes implements Iterable<RoutingNode> {
public List<MutableShardRouting> shardsRoutingFor(String index, int shardId) {
List<MutableShardRouting> shards = newArrayList();
for (RoutingNode routingNode : this) {
for (MutableShardRouting shardRouting : routingNode) {
List<MutableShardRouting> nShards = routingNode.shards();
for (int i = 0; i < nShards.size(); i++) {
MutableShardRouting shardRouting = nShards.get(i);
if (shardRouting.index().equals(index) && shardRouting.id() == shardId) {
shards.add(shardRouting);
}
}
}
for (MutableShardRouting shardRouting : unassigned) {
for (int i = 0; i < unassigned.size(); i++) {
MutableShardRouting shardRouting = unassigned.get(i);
if (shardRouting.index().equals(index) && shardRouting.id() == shardId) {
shards.add(shardRouting);
}