Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / examples / java / app / masterworker / Worker.java
index ff68aac..70dfc74 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014. The SimGrid Team.
+/* Copyright (c) 2006-2019. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,19 +25,21 @@ public class Worker extends Process {
       System.exit(1);
     }
 
-    int num = Integer.valueOf(args[0]).intValue();
-    //Msg.info("Receiving on 'worker_"+num+"'");
+    int num = Integer.parseInt(args[0]);
+    Msg.debug("Receiving on 'worker_"+num+"'");
 
     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.");
+      Msg.info("Received \"" + task.getName() +  "\". Processing it (my pid is "+getPID()+").");
       try {
         task.execute();
-      } catch (TaskCancelledException e) {}
+      } catch (TaskCancelledException e) {
+        e.printStackTrace();
+      }
     }
 
     Msg.info("Received Finalize. I'm done. See you!");