Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[cmake] kill unused cruft aiming at surviving pre-c++11 or pre-c99 compilers
[simgrid.git] / examples / scala / master_slave_kill / Slave.scala
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
10 import org.simgrid.msg.HostFailureException
11 import org.simgrid.msg.HostNotFoundException
12 import org.simgrid.msg.Msg
13 import org.simgrid.msg.MsgException
14 import org.simgrid.msg.Task
15 import org.simgrid.msg.TimeoutException
16 import org.simgrid.msg.TransferFailureException
17 import org.simgrid.msg.Process
18
19 class Slave(hostname:String, name:String) extends Process(hostname, name) {
20   def main(args:Array[String]) {
21     Msg.info("Slave Hello!")
22         
23     val task = new FinalizeTask();
24     Msg.info("Send Mail1!");
25     task.send("mail1");
26         
27     try {
28       Task.receive("mail2");
29     } catch {
30       case e:MsgException => {Msg.debug("Received failed")
31                               return}
32     }
33     Msg.info("Receive Mail2!")
34   }
35 }