1 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
8 import org.simgrid.msg.*;
9 import org.simgrid.msg.Process;
11 class Sleeper extends Process {
12 public Sleeper(Host host, String name, String[] args) {
13 super(host,name,args);
15 public void main(String[] args) {
16 boolean stillAlive = true;
18 Msg.info("I'm not dead");
22 } catch (HostFailureException e) {
24 Msg.info("catch HostException: "+e.getLocalizedMessage());
30 class TestRunner extends Process {
31 public TestRunner(Host host, String name, String[] args) {
32 super(host,name,args);
35 public void main(String[] strings) throws MsgException {
36 Host host = Host.getByName("Tremblay");
38 Msg.info("**** **** **** ***** ***** Test Sleep ***** ***** **** **** ****");
39 Msg.info("Test sleep: Create a process on "+host.getName()+" that simply make periodic sleep, turn off "
41 new Sleeper(host, "Sleeper", null).start();
44 Msg.info("Stop "+host.getName());
46 Msg.info(host.getName()+" has been stopped");
48 Msg.info("Test sleep seems ok, cool! (number of Process : " + Process.getCount()
49 + ", it should be 1 (i.e. the Test one))");
53 public class SleepHostOff {
54 public static void main(String[] args) throws Exception {
57 if (args.length < 1) {
58 Msg.info("Usage: java -cp simgrid.jar:. sleephostoff.SleepHostOff <platform.xml>");
62 Msg.createEnvironment(args[0]);
64 new TestRunner(Host.getByName("Fafard"), "TestRunner", null).start();