Logo AND Algorithmique Numérique Distribuée

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