Updated the bucket refresh operation to use 1 thread to update each bucket

This commit is contained in:
Joshua Kissoon 2014-03-06 16:38:46 +05:30
parent cabb5af742
commit 796e41dd9a

View File

@ -40,12 +40,26 @@ public class BucketRefreshOperation implements Operation
for (int i = 1; i < NodeId.ID_LENGTH; i++) for (int i = 1; i < NodeId.ID_LENGTH; i++)
{ {
/* Construct a NodeId that is i bits away from the current node Id */ /* Construct a NodeId that is i bits away from the current node Id */
NodeId current = this.localNode.getNodeId().generateNodeIdByDistance(i); final NodeId current = this.localNode.getNodeId().generateNodeIdByDistance(i);
// System.out.println("Distance: " + localNode.getNodeId().getDistance(current) + " - ID: " + current); /* Run the Node Lookup Operation, each in a different thread to speed up things */
new Thread()
{
@Override
public void run()
{
try
{
System.out.println("Distance: " + localNode.getNodeId().getDistance(current) + " - ID: " + current);
/* Run the Node Lookup Operation */ new NodeLookupOperation(server, localNode, localNode.getNodeId()).execute();
new NodeLookupOperation(this.server, this.localNode, this.localNode.getNodeId()).execute(); }
catch (IOException e)
{
e.printStackTrace();
}
}
}.start();
} }
} }
} }