From: Martin Quinson Date: Sun, 26 Apr 2015 21:51:42 +0000 (+0200) Subject: this example needs to forcefully destroy the VMs X-Git-Tag: v3_12~732^2~50^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/25ed869bd9f1204b424847f48e62eaefb50604dc this example needs to forcefully destroy the VMs --- diff --git a/examples/java/cloud/migration/Test.java b/examples/java/cloud/migration/Test.java index f361ddc99f..b697049f8e 100644 --- a/examples/java/cloud/migration/Test.java +++ b/examples/java/cloud/migration/Test.java @@ -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(); + } } diff --git a/src/bindings/java/org/simgrid/msg/VM.java b/src/bindings/java/org/simgrid/msg/VM.java index 1406898e2a..77cdaeeb1b 100644 --- a/src/bindings/java/org/simgrid/msg/VM.java +++ b/src/bindings/java/org/simgrid/msg/VM.java @@ -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 */