Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
33eea2d074703f0e071ccfb8b2ab77b6c9bcc209
[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       while(true) { 
18          Task t = Task.get(0);  
19          
20          if (t instanceof FinalizeTask) {
21             break;
22          }
23          BasicTask task = (BasicTask)t;
24          Msg.info("Received \"" + task.getName() + "\" ");
25                  
26          Msg.info("Processing \"" + task.getName() +  "\" ");    
27          task.execute();
28          Msg.info("\"" + task.getName() + "\" done ");
29        }
30        
31       Msg.info("Received Finalize. I'm done. See you!");
32     }
33 }