1 /* Copyright (c) 2006-2007, 2010, 2013-2014, 2016. 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. */
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.Comm;
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.Task;
12 import org.simgrid.msg.Process;
13 import org.simgrid.msg.HostFailureException;
14 import org.simgrid.msg.TimeoutException;
15 import org.simgrid.msg.TransferFailureException;
17 public class Receiver extends Process {
18 public Receiver (Host host, String name) {
23 public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
24 Comm comm = Task.irecv(getHost().getName());
25 Msg.info("I started receiving on '"+ getHost().getName() +". Wait 0.1 second, and block on the communication.");
28 comm.waitCompletion();
29 } catch (TimeoutException e) {
30 Msg.info("Timeout while waiting for my task");
31 throw e; // Stop this process
33 Msg.info("I got my task, good bye.");