Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1ab7253b92f2a388dcad5949f098981916df7371
[simgrid.git] / examples / deprecated / java / process / startkilltime / Sleeper.java
1 /* Copyright (c) 2006-2019. 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.startkilltime;
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.Host;
10 import org.simgrid.msg.Process;
11 import org.simgrid.msg.MsgException;
12
13 public class Sleeper extends Process {
14   public Sleeper(Host host, String name, String[]args) {
15     super(host,name,args);
16   }
17
18   public void main(String[] args) throws MsgException {
19     Msg.info("Hello! I go to sleep.");
20     try {
21       waitFor(Integer.parseInt(args[0]));
22       Msg.info("Done sleeping");
23     } catch (MsgException e) {
24       Msg.debug("Wait cancelled.");
25     }
26   }
27 }