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