Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 31 May 2016 07:43:44 +0000 (09:43 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 31 May 2016 08:30:43 +0000 (10:30 +0200)
examples/java/app/pingpong/Main.java
examples/java/app/pingpong/Receiver.java
examples/java/cloud/masterworker/Master.java
examples/java/energy/vm/EnergyVMRunner.java

index 3352474..9a049c2 100644 (file)
@@ -10,7 +10,7 @@ import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.NativeException;
  
 class Main {
-  public static void main(String[] args) throws HostNotFoundException,NativeException{
+  public static void main(String[] args) throws HostNotFoundException, NativeException{
     Msg.init(args);
     if(args.length < 1) {
       Msg.info("Usage   : Main platform_file");
index e4469b3..4e59a48 100644 (file)
@@ -13,8 +13,8 @@ import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
 
 public class Receiver extends Process {
-  static final double commSizeLat = 1;
-  static final double commSizeBw = 100000000;
+  static final double COMM_SIZE_LAT = 1;
+  static final double COMM_SIZE_BW = 100000000;
   public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
     super(hostname,name,args);
   }
@@ -36,7 +36,7 @@ public class Receiver extends Process {
 
     double communicationTime = timeGot - time;
     Msg.info("Communication time : " + communicationTime);
-    Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");
+    Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");
     Msg.info("goodbye!");
   }
 }
\ No newline at end of file
index c783dec..b5200ca 100644 (file)
@@ -25,7 +25,7 @@ public class Master extends Process {
 
   public void main(String[] args) throws MsgException {
     int workersCount = Main.hostNB;
-    ArrayList<VM> vms = new ArrayList<VM>();
+    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,8 +79,8 @@ 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).shutdown();
+        vms.get(i).finalize();
     }
     Msg.info("Master done.");
   }
index b7a2102..4094a20 100644 (file)
@@ -30,6 +30,7 @@ public class EnergyVMRunner extends Process {
       try {
         task.execute();
       } catch (HostFailureException | TaskCancelledException e) {
+        Msg.error(e.getMessage());
         e.printStackTrace();
       } 
       Msg.info("This worker is done."); 
@@ -41,10 +42,7 @@ public class EnergyVMRunner extends Process {
   }
 
   @Override
-  public void main(String[] strings) throws MsgException, HostNotFoundException {
-    double startTime = 0;
-    double endTime = 0;
-
+  public void main(String[] strings) throws HostNotFoundException, HostFailureException {
     /* get hosts */
     Host host1 = Host.getByName("MyHost1");
     Host host2 = Host.getByName("MyHost2");