Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
38c266a00adbbebbafbd2954a3ba9f56799c577c
[simgrid.git] / examples / scala / master_slave_kill / Slave.scala
1 /*
2  * Copyright 2006-2012. The SimGrid Team. All rights reserved. 
3  *
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. 
6  */
7 package master_slave_kill
8
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 class Slave(hostname:String, name:String) extends Process(hostname, name) {
19   def main(args:Array[String]) {
20     Msg.info("Slave Hello!")
21         
22     val task = new FinalizeTask();
23     Msg.info("Send Mail1!");
24     task.send("mail1");
25         
26     try {
27       Task.receive("mail2");
28     } catch {
29       case e:MsgException => {Msg.debug("Received failed")
30                               return}
31     }
32     Msg.info("Receive Mail2!")
33   }
34 }