Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more consistant identifier names around Java objects' finalization
[simgrid.git] / src / bindings / java / org / simgrid / msg / VM.java
index 5efe9f2..1406898 100644 (file)
@@ -73,8 +73,13 @@ public class VM extends Host{
                }
                return null; 
        }
+       @Override
        protected void finalize() {
-               destroy();
+               try {
+                       nativeFinalize();
+               } catch (Throwable e) {
+                       e.printStackTrace();
+               }
        }
 
 
@@ -156,8 +161,8 @@ public class VM extends Host{
                try {
                        this.internalmig(destination);
                } catch (Exception e){
-                       Msg.info("an exception occurs during the migration of VM "+this.getName());
-                       throw new HostFailureException();
+                 Msg.info("Migration of VM "+this.getName()+" to "+destination.getName()+" is impossible ("+e.getMessage()+")");
+                 throw new HostFailureException();
                }
                // If the migration correcly returned, then we should change the currentHost value. 
                this.currentHost = destination; 
@@ -199,10 +204,7 @@ public class VM extends Host{
        public native void restore();
 
 
-       /**
-        * Destroy the VM
-        */
-       public native void destroy();
+       private native void nativeFinalize();