Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(kinda) working java wrappers by Malek and me
[simgrid.git] / examples / java / basic / Slave.java
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier         
5  * All rights reserved. 
6  *
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. 
9  */
10
11 import simgrid.msg.*;
12
13 public class Slave extends simgrid.msg.Process {
14    public void main(String[] args) throws JniException, NativeException {
15       Msg.info("Hello !");
16       
17       Channel channel = new Channel(0);
18
19       while(true) { 
20          BasicTask task=(BasicTask)channel.get();
21          
22          Msg.info("Received \"" + task.getName() + "\" ");
23          
24          if (task.getData() == 0) {
25             Msg.info("task.getData() gave null \"" + task.getName() + "\" ");
26          } else if(task.getData() == 221297) {
27             break;
28          }
29          
30          Msg.info("Processing \"" + task.getName() +  "\" ");
31          
32          task.execute();
33          Msg.info("\"" + task.getName() + "\" done ");
34        }
35        
36        Msg.info("I'm done. See you!");
37     }
38 }