Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
38945df3dd6a89d9c75d802d1e0d034be5200d68
[simgrid.git] / examples / java / 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 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 public class Main {
15   public static Mutex mutex;
16   public static Process processToMigrate = null;
17
18   public static void main(String[] args) throws NativeException {
19     Msg.init(args);
20     if(args.length < 1) {
21       Msg.info("Usage   : Migration platform_file");
22       Msg.info("example : Migration ../platforms/platform.xml");
23       System.exit(1);
24     }
25     /* Create the mutex */
26     mutex = new Mutex();
27
28     /* construct the platform*/
29     Msg.createEnvironment(args[0]);
30     /* bypass deploymemt */
31     try {
32         Policeman policeman = new Policeman("Boivin","policeman");
33         policeman.start();
34         Emigrant emigrant   = new Emigrant("Jacquelin","emigrant");
35         emigrant.start();
36     } catch (HostNotFoundException e){
37       System.out.println("Create processes failed!");
38     }
39
40     /*  execute the simulation. */
41     Msg.run();
42   }
43 }