Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Incorporate simgrid-java in simgrid-java/.
[simgrid.git] / simgrid-java / examples / priority / Test.java
1 /*
2  * 2012. 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 package priority;
8 import org.simgrid.msg.Host;
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.MsgException;
11 import org.simgrid.msg.Task;
12 import org.simgrid.msg.Process;
13
14 public class Test extends Process {
15         public Test(Host host, String name, String[]args) {
16                 super(host,name,args);
17         }
18         public void main(String[] args) throws MsgException {   
19                 double computationAmount = 1.0;
20                 double priority = 1.0;
21                 
22                 computationAmount = Double.valueOf(args[0]);
23                 priority = Double.valueOf(args[1]);
24                 
25                 Msg.info("Hello! Running a task of size " + computationAmount + " with priority " + priority);
26                 
27                 Task task = new Task("Task", computationAmount, 0);
28                 task.setPriority(priority);
29                 
30                 task.execute();
31                 
32                 Msg.info("Goodbye now!");
33         }
34 }