X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/af28b79e5d8af428e4240cf922e3335030a6f6e5..5c108161f0c1d82e2ab7590344d0aa2322736019:/org/simgrid/msg/VM.java diff --git a/org/simgrid/msg/VM.java b/org/simgrid/msg/VM.java index 137fa17249..525ea391e8 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 @@ -22,25 +22,31 @@ public class VM { private long bind = 0; private int coreAmount; + + private String name; /** * @brief Create a new empty 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(Host host, int coreAmount) { + public VM(Host host, String name, int coreAmount) { this.coreAmount = coreAmount; + this.name = name; + start(host,name,coreAmount); + } + protected void finalize() { + destroy(); } /** - * Natively implemented method starting the VM. - * @param coreAmount + * Destroy the VM */ - private native void start(Host host, 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, String name, int coreAmount); + /** @brief Returns whether the given VM is currently suspended */ public native boolean isSuspended(); @@ -76,5 +82,17 @@ public class VM { * of VM resume to you. */ public native void resume(); - -} \ No newline at end of file + /** + * @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(); + + public String getName() { + return name; + } +}