2 * Copyright 2006,2007,2010. The SimGrid Team. 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.
8 import simgrid.msg.HostFailureException;
9 import simgrid.msg.Msg;
10 import simgrid.msg.Task;
11 import simgrid.msg.TaskCancelledException;
12 import simgrid.msg.TimeoutException;
13 import simgrid.msg.TransferFailureException;
15 public class Slave extends simgrid.msg.Process {
16 public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
17 if (args.length < 1) {
18 Msg.info("Slave needs 1 argument (its number)");
22 int num = Integer.valueOf(args[0]).intValue();
23 //Msg.info("Receiving on 'slave_"+num+"'");
26 Task task = Task.receive("slave_"+num);
28 if (task instanceof FinalizeTask) {
31 Msg.info("Received \"" + task.getName() + "\". Processing it.");
34 } catch (TaskCancelledException e) {
37 // Msg.info("\"" + task.getName() + "\" done ");
40 //Msg.info("Received Finalize. I'm done. See you!");