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_kill;
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_kill.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!");
26 Process process2 = null;
27 //Create a slave on host "alice"
29 Msg.info("Create process on host 'alice'");
30 process2 = new Slave("alice","slave");
32 } catch (MsgException e){
33 System.out.println("Process2!");
36 //Wait for slave "alice"
39 Task task = Task.receive("mail1");
40 if (task instanceof FinalizeTask) {
41 Msg.info("Received mail1!");
47 Msg.info("Process2 is now killed, should exit now");