Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
dc057a2d8719e68f8a46df5b19b6b214e12d5ed4
[simgrid.git] / examples / commTime / Slave.java
1 /*
2  * Copyright 2006,2007,2010. The SimGrid Team. All rights reserved. 
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. 
6  */
7
8 package commTime;
9
10 import org.simgrid.msg.*;
11
12 public class Slave extends org.simgrid.msg.Process {
13    public void main(String[] args) throws MsgException {
14       if (args.length < 1) {
15          Msg.info("Slave needs 1 argument (its number)");
16          System.exit(1);
17       }
18
19       int num = Integer.valueOf(args[0]).intValue();
20       Msg.info("Receiving on 'slave_"+num+"'");
21       
22       while(true) { 
23          Task task = Task.receive("slave_"+num);        
24          
25          if (task instanceof FinalizeTask) {
26             break;
27          }
28          task.execute();
29        }
30        
31       Msg.info("Received Finalize. I'm done. See you!");
32     }
33 }