Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cannot let GC destroy VM itself ...
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 31 May 2016 08:48:31 +0000 (10:48 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 31 May 2016 08:48:31 +0000 (10:48 +0200)
AFAIU, VMs are special hosts, surf_exit try to free them before GC
kicks in. After many tries, decide to rename finalize as destroy and
call this method explicitly as before.

examples/java/cloud/masterworker/Master.java
examples/java/cloud/migration/Test.java
examples/java/energy/vm/EnergyVMRunner.java
src/bindings/java/org/simgrid/msg/VM.java

index b5200ca..586c910 100644 (file)
@@ -79,8 +79,7 @@ public class Master extends Process {
     Msg.info("Let's shut down the simulation and kill everyone.");
 
     for (int i = 0; i < vms.size(); i++) {
     Msg.info("Let's shut down the simulation and kill everyone.");
 
     for (int i = 0; i < vms.size(); i++) {
-        vms.get(i).shutdown();
-        vms.get(i).finalize();
+      vms.get(i).destroy();
     }
     Msg.info("Master done.");
   }
     }
     Msg.info("Master done.");
   }
index c9ccc6e..5eee62d 100644 (file)
@@ -143,6 +143,6 @@ public class Test extends Process{
     Main.setEndOfTest();
     Msg.info("Forcefully destroy VMs");
     for (VM vm: vms)
     Main.setEndOfTest();
     Msg.info("Forcefully destroy VMs");
     for (VM vm: vms)
-      vm.finalize();
+      vm.destroy();
   }
 }
   }
 }
index 4094a20..d8ecb21 100644 (file)
@@ -73,9 +73,7 @@ public class EnergyVMRunner extends Process {
     Msg.info("Wait another 5 seconds. The tasks stop at some point in between"); 
     waitFor(5); 
 
     Msg.info("Wait another 5 seconds. The tasks stop at some point in between"); 
     waitFor(5); 
 
-    vmHost1.shutdown(); 
-    vmHost3.shutdown(); 
-    vmHost1.finalize(); 
-    vmHost3.finalize(); 
+    vmHost1.destroy(); 
+    vmHost3.destroy(); 
   }
 }
   }
 }
index cd2c7e8..9f78fa4 100644 (file)
@@ -62,11 +62,11 @@ public class VM extends Host{
                }
                return null; 
        }
                }
                return null; 
        }
-       @Override
-       public void finalize() {
+       
+       public void destroy() {
                try {
                        nativeFinalize();
                try {
                        nativeFinalize();
-               } catch (Throwable e) {
+               } catch (Exception e) {
                        e.printStackTrace();
                }
        }
                        e.printStackTrace();
                }
        }