Logo AND Algorithmique Numérique Distribuée

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