Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge tag 'v3_9_90' into hypervisor
[simgrid.git] / examples / java / master_slave_kill / Slave.java
1 /*
2  * Copyright (c) 2006-2013. The SimGrid Team.
3  * All rights reserved.
4  *
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. 
7  */
8 package master_slave_kill;
9 import org.simgrid.msg.HostFailureException;
10 import org.simgrid.msg.HostNotFoundException;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.Task;
14 import org.simgrid.msg.TimeoutException;
15 import org.simgrid.msg.TransferFailureException;
16 import org.simgrid.msg.Process;
17
18 import master_slave_kill.FinalizeTask;
19
20 public class Slave extends Process {
21         public Slave(String hostname, String name) throws HostNotFoundException {
22                 super(hostname, name);
23         }
24         public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
25         Msg.info("Slave Hello!");
26         
27         FinalizeTask task = new FinalizeTask();
28         Msg.info("Send Mail1!");
29         task.send("mail1");
30         
31         try {
32                 Task.receive("mail2");
33         } catch (MsgException e) {
34                 Msg.debug("Received failed");
35                 return;
36         }
37         Msg.info("Receive Mail2!");
38   }
39 }