X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1b9fb754fbeabeb4c3892917997208e1972fc338..93bb995eb4c9ce2749261e37e6621dcc639e8eb0:/org/simgrid/msg/VM.java diff --git a/org/simgrid/msg/VM.java b/org/simgrid/msg/VM.java index c1a4de4830..3de79f9343 100644 --- a/org/simgrid/msg/VM.java +++ b/org/simgrid/msg/VM.java @@ -1,7 +1,7 @@ /* * JNI interface to Cloud interface in Simgrid * - * Copyright 2006,2007,2010,2012 The SimGrid Team. + * Copyright 2006-2012 The SimGrid Team. * All right reserved. * * This program is free software; you can redistribute @@ -10,6 +10,7 @@ */ package org.simgrid.msg; +import org.simgrid.msg.Host; import org.simgrid.msg.Process; public class VM { @@ -26,20 +27,23 @@ public class VM { * @bug it is expected that in the future, the coreAmount parameter will be used * to add extra constraints on the execution, but the argument is ignored for now. */ - public VM(int coreAmount) { + public VM(Host host, int coreAmount) { this.coreAmount = coreAmount; + start(host,coreAmount); + } + protected void finalize() { + destroy(); } /** - * Natively implemented method starting the VM. - * @param coreAmount + * Destroy the VM */ - private native void start(int coreAmount); - + protected native void destroy(); /** - * @brief Returns a new array containing all existing VMs. + * Natively implemented method starting the VM. + * @param coreAmount */ - public static native VM[] all(); - + private native void start(Host host, int coreAmount); + /** @brief Returns whether the given VM is currently suspended */ public native boolean isSuspended(); @@ -75,5 +79,14 @@ public class VM { * of VM resume to you. */ public native void resume(); + /** + * @brief Immediately kills all processes within the given VM. Any memory that they allocated will be leaked. + * No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something + */ + public native void shutdown(); + /** + * @brief Reboot the VM, restarting all the processes in it. + */ + public native void reboot(); } \ No newline at end of file