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;
12 import org.simgrid.msg.HostNotFoundException;
13 import org.simgrid.msg.Msg;
14 import org.simgrid.msg.MsgException;
15 import org.simgrid.msg.Process;
16 import org.simgrid.msg.Task;
18 import master_slave_bypass.FinalizeTask;
20 public class Master extends Process {
21 public Master(String hostname, String name) throws HostNotFoundException {
22 super(hostname, name);
24 public void main(String[] args) throws MsgException {
25 Msg.info("Master Hello!");
27 //Create a slave on host "alice"
29 Msg.info("Create process on host 'alice'");
30 new Slave("alice","process2").start();
32 catch (MsgException e){
33 System.out.println("Process2!");
36 //Wait for slave "alice"
39 Task task = Task.receive("alice");
40 if (task instanceof FinalizeTask) {
41 Msg.info("Received Finalize. I'm done. See you!");