This commit is contained in:
Dario Guzik
2011-05-15 18:34:15 -03:00
parent 56fd098ee2
commit 202d68a21c

View File

@@ -55,10 +55,12 @@ public class Sharded<R, S extends ShardInfo<R>> {
for (int i = 0; i != shards.size(); ++i) { for (int i = 0; i != shards.size(); ++i) {
final S shardInfo = shards.get(i); final S shardInfo = shards.get(i);
for (int n = 0; n < 160 * shardInfo.getWeight(); n++) {
if (shardInfo.getName() == null) if (shardInfo.getName() == null)
for (int n = 0; n < 160 * shardInfo.getWeight(); n++) {
nodes.put(this.algo.hash("SHARD-" + i + "-NODE-" + n), shardInfo); nodes.put(this.algo.hash("SHARD-" + i + "-NODE-" + n), shardInfo);
}
else else
for (int n = 0; n < 160 * shardInfo.getWeight(); n++) {
nodes.put(this.algo.hash(shardInfo.getName() + "*" + shardInfo.getWeight() + n), shardInfo); nodes.put(this.algo.hash(shardInfo.getName() + "*" + shardInfo.getWeight() + n), shardInfo);
} }
resources.put(shardInfo, shardInfo.createResource()); resources.put(shardInfo, shardInfo.createResource());