1 /* Copyright (c) 2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 package sleep_host_off;
9 import org.simgrid.msg.*;
10 import org.simgrid.msg.Process;
11 import org.simgrid.trace.Trace;
13 import java.util.ArrayList;
14 import java.util.List;
15 import java.util.Random;
17 public class SleepHostOff extends Process{
18 public static Host jupiter = null;
20 public SleepHostOff(Host host, String name, String[]args) {
21 super(host,name,args);
24 public void main(String[] strings) throws MsgException {
27 jupiter = Host.getByName("Jupiter");
28 } catch (HostNotFoundException e) {
29 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
32 Msg.info("**** **** **** ***** ***** Test Sleep ***** ***** **** **** ****");
33 Msg.info("Test sleep: Create a process on Jupiter, the process simply make periodic sleep, turn off Jupiter");
34 new Process(jupiter, "sleep", null) {
35 public void main(String[] args) {
37 Msg.info("I'm not dead");
40 } catch (HostFailureException e) {
41 Msg.info("catch HostException: "+e.getLocalizedMessage());
42 break; //Break is needed to finalize the endless loop
49 Msg.info("Stop Jupiter");
51 Msg.info("Jupiter has been stopped");
53 Msg.info("Test sleep seems ok, cool !(number of Process : " + Process.getCount() + ", it should be 1 (i.e. the Test one))\n");