Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'coverity_scan' of github.com:mquinson/simgrid
[simgrid.git] / examples / java / 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 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 = 1.0;
21     double priority = 1.0;
22
23     computationAmount = Double.valueOf(args[0]);
24     priority = Double.valueOf(args[1]);
25
26     Msg.info("Hello! Running a task of size " + computationAmount + " with priority " + priority);
27
28     Task task = new Task("Task", computationAmount, 0);
29     task.setPriority(priority);
30
31     task.execute();
32
33     Msg.info("Goodbye now!");
34   }
35 }