for (ShardIterator shardIterator : shardIterators) {
shardRouting = shardIterator.nextOrNull();
if (shardRouting != null && shardRouting.active()) {
processShardRouting(locations, shardRouting);
} else {
throw new UnavailableShardsException(shardIterator.shardId());
}
}
return new Routing(locations);
}