Logo AND Algorithmique Numérique Distribuée

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