Msg.init(args);
if(args.length < 2) {
Msg.info("Usage : Bittorrent platform_file deployment_file");
- Msg.info("example : Bittorrent ../platforms/platform.xml bittorrent.xml");
+ Msg.info("example : Bittorrent ../platforms/cluster.xml bittorrent.xml");
System.exit(1);
}
Msg.deployApplication(args[1]);
/* execute the simulation. */
- Msg.run();
+ Msg.run();
}
}
while(true) {
Task task = Task.receive("worker_"+num);
- if (task.getName().equals("finalize")) {
+ if ("finalize".equals(task.getName())) {
break;
}
Msg.info("Received \"" + task.getName() + "\". Processing it.");
private int id;
public Bucket(int id) {
- this.nodes = new ArrayList<Integer>();
+ this.nodes = new ArrayList<>();
this.id = id;
}
/* Add the content of the bucket into a answer object. */
public void addToAnswer(Answer answer, int destination) {
- for (int id : this.nodes) {
- answer.getNodes().add(new Contact(id,id ^ destination));
+ for (int nodeId : this.nodes) {
+ answer.getNodes().add(new Contact(nodeId,nodeId ^ destination));
}
}
Msg.info("Creating 50 new Semaphores, yielding and triggering a GC after each");
for(j = 1; j <= 50; j++) {
sem = new Semaphore(0);
- waitFor(10);
+ waitFor(10);
System.gc();
}
Msg.info("It worked, we survived. The test is passed.");
}
public class SemaphoreGC {
+ private SemaphoreGC() {
+ throw new IllegalAccessError("Utility class");
+ }
+
public static void main(String[] args) throws Exception {
Msg.init(args);
if (args.length < 1) {