Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
64fbfdc4f58a8b6952ea809413a5be669e79f6dd
[simgrid.git] / examples / deprecated / java / app / pingpong / Main.java
1 /* Copyright (c) 2006-2021. 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       Msg.error("File " + platfFile + " does not exist in " + System.getProperty("user.dir"));
29       Msg.error("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 }