X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e28a9a1f0dfaa7161fa5b5e65c4515afdd88b3b1..8e6b22bbbde4130f0b21491404f2af0f57df8019:/examples/java/energy/vm/EnergyVMRunner.java diff --git a/examples/java/energy/vm/EnergyVMRunner.java b/examples/java/energy/vm/EnergyVMRunner.java index b7a2102388..09e0a735b1 100644 --- a/examples/java/energy/vm/EnergyVMRunner.java +++ b/examples/java/energy/vm/EnergyVMRunner.java @@ -10,7 +10,6 @@ import org.simgrid.msg.VM; import org.simgrid.msg.Host; import org.simgrid.msg.Task; import org.simgrid.msg.Process; -import org.simgrid.msg.MsgException; import org.simgrid.msg.HostFailureException; import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.TaskCancelledException; @@ -30,6 +29,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 +41,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"); @@ -75,9 +72,7 @@ public class EnergyVMRunner extends Process { Msg.info("Wait another 5 seconds. The tasks stop at some point in between"); waitFor(5); - vmHost1.shutdown(); - vmHost3.shutdown(); - vmHost1.finalize(); - vmHost3.finalize(); + vmHost1.destroy(); + vmHost3.destroy(); } }