Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / examples / deprecated / java / process / migration / Main.java
1 /* Copyright (c) 2012-2022. 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 process.migration;
8 import org.simgrid.msg.HostNotFoundException;
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.Mutex;
11 import org.simgrid.msg.Process;
12
13 class Main {
14   protected static Mutex mutex;
15   protected static Process processToMigrate = null;
16
17   private Main() {
18     throw new IllegalAccessError("Utility class");
19   }
20
21   public static void main(String[] args) {
22     Msg.init(args);
23     if(args.length < 1) {
24       Msg.info("Usage   : Migration platform_file");
25       Msg.info("example : Migration ../platforms/platform.xml");
26       System.exit(1);
27     }
28     /* Create the mutex */
29     mutex = new Mutex();
30
31     /* construct the platform*/
32     Msg.createEnvironment(args[0]);
33     /* bypass deploymemt */
34     try {
35         Policeman policeman = new Policeman("Boivin","policeman");
36         policeman.start();
37         Emigrant emigrant   = new Emigrant("Jacquelin","emigrant");
38         emigrant.start();
39         processToMigrate = emigrant;
40     } catch (HostNotFoundException e){
41       Msg.error("Create processes failed!");
42       e.printStackTrace();
43     }
44
45     /*  execute the simulation. */
46     Msg.run();
47   }
48 }