Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a few more fixes
[simgrid.git] / examples / java / process / kill / Killer.java
1 /* Copyright (c) 2006-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 package process.kill;
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.Process;
10 import org.simgrid.msg.MsgException;
11 import org.simgrid.msg.HostNotFoundException;
12
13 import process.kill.Victim;
14
15 public class Killer extends Process {
16   public Killer(String hostname, String name) throws HostNotFoundException {
17     super(hostname, name);
18   }
19   public void main(String[] args) throws MsgException {
20     Victim poorVictim = null;
21     Msg.info("Hello!");
22     try {
23       poorVictim = new Victim("Boivin","victim");
24       poorVictim.start();
25     } catch (MsgException e){
26       Msg.error("Cannot create the victim process!");
27     }
28     sleep(10000);
29     Msg.info("Resume Process");
30     if (poorVictim != null)
31       poorVictim.resume();
32     sleep(1000);
33     Msg.info("Kill Process");
34     poorVictim.kill();
35
36     Msg.info("Ok, goodbye now.");
37   }
38 }