X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dab3029067ba2677a42fb2f4f2c3b3b2f71e33c2..b16609ebdc24c811f373a0573870a32d0379b2f0:/examples/java/process/kill/Killer.java diff --git a/examples/java/process/kill/Killer.java b/examples/java/process/kill/Killer.java index 49bfc404a6..c82af1d3bd 100644 --- a/examples/java/process/kill/Killer.java +++ b/examples/java/process/kill/Killer.java @@ -23,16 +23,20 @@ public class Killer extends Process { poorVictim = new Victim("Boivin","victim"); poorVictim.start(); } catch (MsgException e){ + e.printStackTrace(); Msg.error("Cannot create the victim process!"); + return; } sleep(10000); Msg.info("Resume Process"); - if (poorVictim != null) - poorVictim.resume(); + poorVictim.resume(); sleep(1000); Msg.info("Kill Process"); poorVictim.kill(); Msg.info("Ok, goodbye now."); + // The actor can also commit a suicide with the following command + exit(); // This will forcefully stop the current actor + // Of course, it's not useful here at the end of the main function, but that's for the example (and to check that this still works in the automated tests) } }