2 * Copyright (c) 2012-2013. The SimGrid Team.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package.
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.Process;
14 import org.simgrid.msg.Task;
16 public class Slave extends Process {
18 public Slave(Host host, int number) {
19 super(host,"WRK0" + number,null);
22 public void main(String[] args) throws MsgException {
23 Msg.info(this.msgName() +" is listenning on MBOX:WRK0"+ number);
27 task = Task.receive("MBOX:WRK0"+number);
28 } catch (MsgException e) {
29 Msg.debug("Received failed. I'm done. See you!");
32 if (task instanceof FinalizeTask) {
33 Msg.info("Received Finalize. I'm done. See you!");
36 Msg.info("Received \"" + task.getName() + "\". Processing it.");
39 } catch (MsgException e) {
42 Msg.info(this.msgName() +" executed task (" + task.getName()+")");