Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
539fd34f59c8e5168ef0fc358ccb42554d8ffda9
[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 import simgrid.msg.*;
9
10 public class Slave extends simgrid.msg.Process {
11    public void main(String[] args) throws MsgException {
12       if (args.length < 1) {
13          Msg.info("Slave needs 1 argument (its number)");
14          System.exit(1);
15       }
16
17       int num = Integer.valueOf(args[0]).intValue();
18       Msg.info("Receiving on 'slave_"+num+"'");
19       
20       while(true) { 
21          Task task = Task.receive("slave_"+num);        
22          
23          if (task instanceof FinalizeTask) {
24             break;
25          }
26          task.execute();
27        }
28        
29       Msg.info("Received Finalize. I'm done. See you!");
30     }
31 }