A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement natively VM_getVMByName. Java VMs are now freed
[simgrid.git]
/
src
/
bindings
/
java
/
org
/
simgrid
/
msg
/
VM.java
diff --git
a/src/bindings/java/org/simgrid/msg/VM.java
b/src/bindings/java/org/simgrid/msg/VM.java
index
bfd2715
..
30b8852
100644
(file)
--- a/
src/bindings/java/org/simgrid/msg/VM.java
+++ b/
src/bindings/java/org/simgrid/msg/VM.java
@@
-1,17
+1,15
@@
-/* J
NI interface to virtual machine in Simgrid
*/
+/* J
ava bindings of the s4u::VirtualMachine
*/
-/* Copyright (c) 2006-201
4
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-201
7
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
package org.simgrid.msg;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
package org.simgrid.msg;
-import java.util.ArrayList;
public class VM extends Host {
// No need to declare a new bind variable: we use the one inherited from the super class Host
public class VM extends Host {
// No need to declare a new bind variable: we use the one inherited from the super class Host
- private static ArrayList<VM> vms= new ArrayList<>();
private Host currentHost;
/** Create a `basic' VM (i.e. 1GB of RAM, other values are not taken into account). */
private Host currentHost;
/** Create a `basic' VM (i.e. 1GB of RAM, other values are not taken into account). */
@@
-32,18
+30,13
@@
public class VM extends Host {
super.name = name;
this.currentHost = host;
create(host, name, ramSize, migNetSpeed, dpIntensity);
super.name = name;
this.currentHost = host;
create(host, name, ramSize, migNetSpeed, dpIntensity);
- vms.add(this);
}
}
+ /** Retrieve the list of all existing VMs */
public native static VM[] all();
public native static VM[] all();
- public static VM getVMByName(String name){
- for (VM vm : vms){
- if (vm.getName().equals(name))
- return vm;
- }
- return null;
- }
+ /** Retrieve a VM from its name */
+ public native static VM getVMByName(String name);
/** Shutdown and unref the VM.
*
/** Shutdown and unref the VM.
*
@@
-55,14
+48,13
@@
public class VM extends Host {
*/
public void destroy() {
shutdown();
*/
public void destroy() {
shutdown();
-/// vms.remove(this);
}
/* Make sure that the GC also destroys the C object */
protected void finalize() throws Throwable {
nativeFinalize();
}
}
/* Make sure that the GC also destroys the C object */
protected void finalize() throws Throwable {
nativeFinalize();
}
- p
ublic
native void nativeFinalize();
+ p
rivate
native void nativeFinalize();
/** Returns whether the given VM is currently suspended */
public native int isCreated();
/** Returns whether the given VM is currently suspended */
public native int isCreated();
@@
-134,7
+126,7
@@
public class VM extends Host {
public native void resume();
/** Class initializer (for JNI), don't do it yourself */
public native void resume();
/** Class initializer (for JNI), don't do it yourself */
- p
ublic
static native void nativeInit();
+ p
rivate
static native void nativeInit();
static {
nativeInit();
}
static {
nativeInit();
}