Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove some smells in Java
[simgrid.git] / examples / java / cloud / masterworker / Master.java
index c783dec..c2b95d9 100644 (file)
@@ -24,8 +24,8 @@ public class Master extends Process {
   }
 
   public void main(String[] args) throws MsgException {
-    int workersCount = Main.hostNB;
-    ArrayList<VM> vms = new ArrayList<VM>();
+    int workersCount = Main.NHOSTS;
+    ArrayList<VM> vms = new ArrayList<>();
 
     // Create one VM per host and bind a process inside each one. 
     for (int i = 0; i < workersCount; i++) {
@@ -79,15 +79,14 @@ public class Master extends Process {
     Msg.info("Let's shut down the simulation and kill everyone.");
 
     for (int i = 0; i < vms.size(); i++) {
-      vms.get(i).shutdown();
-      vms.get(i).finalize();
+      vms.get(i).destroy();
     }
     Msg.info("Master done.");
   }
 
   public void workBatch(int workersCount) throws MsgException {
     for (int i = 0; i < workersCount; i++) {
-      Task task = new Task("Task0" + i, Main.task_comp_size, Main.task_comm_size);
+      Task task = new Task("Task0" + i, Main.TASK_COMP_SIZE, Main.TASK_COMM_SIZE);
       Msg.info("Sending to WRK0" + i);
       task.send("MBOX:WRK0" + i);
     }