Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this example needs to forcefully destroy the VMs
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Apr 2015 21:51:42 +0000 (23:51 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Apr 2015 21:51:42 +0000 (23:51 +0200)
examples/java/cloud/migration/Test.java
src/bindings/java/org/simgrid/msg/VM.java

index f361ddc..b697049 100644 (file)
@@ -144,6 +144,9 @@ public class Test extends Process{
         Msg.info("     - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
 
         Main.setEndOfTest();
-        // no need to destroy the VMs: the garbage collector will get them all
+        Msg.info("Forcefully destroy VMs");
+        for (VM vm: vms)
+         vm.finalize();
+       
     }
 }
index 1406898..77cdaee 100644 (file)
@@ -74,13 +74,14 @@ public class VM extends Host{
                return null; 
        }
        @Override
-       protected void finalize() {
+       public void finalize() {
                try {
                        nativeFinalize();
                } catch (Throwable e) {
                        e.printStackTrace();
                }
        }
+       private native void nativeFinalize();
 
 
        /* JNI / Native code */
@@ -204,10 +205,6 @@ public class VM extends Host{
        public native void restore();
 
 
-       private native void nativeFinalize();
-
-
-
        /**
         * Class initializer, to initialize various JNI stuff
         */