1 /* Copyright (c) 2012-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. */
9 import org.simgrid.msg.Host;
10 import org.simgrid.msg.Msg;
11 import org.simgrid.msg.MsgException;
12 import org.simgrid.msg.Process;
13 import org.simgrid.msg.Task;
15 public class Slave extends Process {
17 public Slave(Host host, int number) {
18 super(host,"WRK0" + number,null);
21 public void main(String[] args) throws MsgException {
22 Msg.info(this.msgName() +" is listenning on MBOX:WRK0"+ number);
26 task = Task.receive("MBOX:WRK0"+number);
27 } catch (MsgException e) {
28 Msg.debug("Received failed. I'm done. See you!");
31 if (task instanceof FinalizeTask) {
32 Msg.info("Received Finalize. I'm done. See you!");
35 Msg.info("Received \"" + task.getName() + "\". Processing it.");
38 } catch (MsgException e) {
41 Msg.info(this.msgName() +" executed task (" + task.getName()+")");