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 / migration / Policeman.java
1 /*
2  * 2012. The SimGrid Team. 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
9 import org.simgrid.msg.Host;
10 import org.simgrid.msg.Msg;
11 import org.simgrid.msg.MsgException;
12 import org.simgrid.msg.Process;
13
14 public class Policeman extends Process {
15         public Policeman(Host host, String name, String[]args) {
16                 super(host,name,args);
17         }
18
19         @Override
20         public void main(String[] args) throws MsgException {
21                 waitFor(1);
22                 
23                 Msg.info("Wait a bit before migrating the emigrant.");
24                 
25                 Migration.mutex.acquire();
26                 
27                 Migration.processToMigrate.migrate(Host.getByName("Jacquelin"));
28                 Msg.info("I moved the emigrant");
29                 Migration.processToMigrate.resume();
30         }
31 }