Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge scm.gforge.inria.fr:/gitroot/simgrid/simgrid-java
[simgrid.git] / examples / migration / Migration.java
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier         
5  * All rights reserved. 
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. 
9  */
10 package migration;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.Mutex;
13 import org.simgrid.msg.NativeException;
14 import org.simgrid.msg.Process;
15 /**
16  * Demonstrates the use of Task.setPriority to change
17  * the computation priority of a task
18  */ 
19 public class Migration  {
20         public static Mutex mutex;
21         public static Process processToMigrate = null;
22         
23    /* This only contains the launcher. If you do nothing more than than you can run 
24     *   java simgrid.msg.Msg
25     * which also contains such a launcher
26     */
27     
28     public static void main(String[] args) throws NativeException {     
29                 /* initialize the MSG simulation. Must be done before anything else (even logging). */
30                 Msg.init(args);
31                 if(args.length < 2) {
32                         Msg.info("Usage   : Priority platform_file deployment_file");
33                 Msg.info("example : Priority ping_pong_platform.xml ping_pong_deployment.xml");
34                 System.exit(1);
35                 }
36                 /* Create the mutex */
37                 mutex = new Mutex();            
38                 
39                 /* construct the platform and deploy the application */
40                 Msg.createEnvironment(args[0]);
41                 Msg.deployApplication(args[1]);
42                 
43                 /*  execute the simulation. */
44             Msg.run();
45     }
46 }