Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8e56aed06d6c9208cd726d1fa444fbd4e6f014c0
[simgrid.git] / examples / java / app / pingpong / Main.java
1 /* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 package app.pingpong;
7 import java.io.File;
8
9 import org.simgrid.msg.HostNotFoundException;
10 import org.simgrid.msg.Msg;
11  
12 class Main {
13   protected static final int TASK_COUNT = 3;
14         
15   private Main() {
16     throw new IllegalAccessError("Utility class");
17   }
18
19   public static void main(String[] args) throws HostNotFoundException {
20     Msg.init(args);
21     
22     String platfFile = "../../examples/platforms/small_platform.xml";
23     if (args.length == 1)
24         platfFile = args[0];
25     
26     File f = new File(platfFile); 
27     if (!f.exists()) {
28         System.err.println("File "+platfFile+" does not exist in "+System.getProperty("user.dir"));
29         System.err.println("Usage  : Main ../platforms/platform.xml");
30     }
31     
32     Msg.createEnvironment(platfFile);
33     new Sender("Jacquelin", "Sender", new String[] {"Boivin"}).start();
34     new Receiver ("Boivin", "Receiver", null).start();
35
36     Msg.run();
37   }
38 }