1 /* Master of a basic master/slave example in Java */
3 /* Copyright (c) 2006-2014. The SimGrid Team.
4 * 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. */
9 package master_slave_bypass;
10 import org.simgrid.msg.HostNotFoundException;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.Process;
14 import org.simgrid.msg.Task;
16 import master_slave_bypass.FinalizeTask;
18 public class Master extends Process {
19 public Master(String hostname, String name) throws HostNotFoundException {
20 super(hostname, name);
22 public void main(String[] args) throws MsgException {
23 Msg.info("Master Hello!");
25 //Create a slave on host "alice"
27 Msg.info("Create process on host 'Jacquelin'");
28 new Slave("Jacquelin","process2").start();
30 catch (MsgException e){
31 System.out.println("Process2!");
34 //Wait for slave "alice"
37 Task task = Task.receive("Jacquelin");
38 if (task instanceof FinalizeTask) {
39 Msg.info("Received Finalize. I'm done. See you!");