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