Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Remove host data
[simgrid.git] / src / bindings / java / jmsg_vm.c
index 2df6a93..e508db1 100644 (file)
@@ -1,10 +1,12 @@
 /* Functions related to the MSG VM API. */
 
-/* Copyright (c) 2012-2013. The SimGrid Team.
+/* Copyright (c) 2012-2014. 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. */
+
+#include "jmsg.h"
 #include "jmsg_vm.h"
 #include "jmsg_host.h"
 #include "jmsg_process.h"
@@ -156,7 +158,7 @@ Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   msg_host_t host = MSG_vm_get_pm(vm);
 
-  if (!MSG_host_get_data(host)) {
+  if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) {
     /* the native host not yet associated with the java host instance */
 
     /* instanciate a new java host instance */
@@ -180,9 +182,9 @@ Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) {
     (*env)->SetObjectField(env, jhost, jxbt_get_jfield(env, (*env)->FindClass(env, "org/simgrid/msg/Host"), "name", "Ljava/lang/String;"), jname);
     /* Bind & store it */
     jhost_bind(jhost, host, env);
-    MSG_host_set_data(host, (void *) jhost);
+    xbt_lib_set(host_lib, host->key, JAVA_HOST_LEVEL, (void *) jhost);
   } else {
-    jhost = (jobject) MSG_host_get_data(host);
+    jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL);
   }
 
   return jhost;