1 /* Copyright (c) 2012-2020. 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. */
6 package cloud.masterworker;
8 import org.simgrid.msg.Host;
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.MsgException;
11 import org.simgrid.msg.Process;
12 import org.simgrid.msg.Task;
14 public class Worker extends Process {
15 public Worker(Host host, String name) {
19 public void main(String[] args) throws MsgException {
20 Msg.verb(this.getName() +" is listening on "+ getName());
24 task = Task.receive(getName());
25 } catch (MsgException e) {
26 Msg.info("Received failed. I'm done. See you!");
29 Msg.verb("Received '" + task.getName() + "'. Processing it.");
31 Msg.verb("Done executing task '" + task.getName() +"'");