2 * Master of a basic master/slave example in Java
4 * Copyright (c) 2006-2013. The SimGrid Team.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package.
11 package master_slave_bypass
14 import org.simgrid.msg.HostNotFoundException
15 import org.simgrid.msg.Msg
16 import org.simgrid.msg.MsgException
17 import org.simgrid.msg.Process
18 import org.simgrid.msg.Task
20 class Master(hostname:String, name:String) extends Process(hostname,name) {
22 def main(args:Array[String]) {
23 Msg.info("Master Hello!")
25 //Create a slave on host "alice"
27 Msg.info("Create process on host 'alice'")
28 new Slave("alice","process2").start()
30 case e:MsgException => println("Process2!")
33 //Wait for slave "alice"
34 continually({Task.receive("alice")})
35 .takeWhile(!_.isInstanceOf[FinalizeTask])
36 .force // to force the list to be compute
38 Msg.info("Received Finalize. I'm done. See you!")