Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
actually kill models' names
[simgrid.git] / src / bindings / java / jmsg_as.c
index 0e6e89c..f3ed319 100644 (file)
@@ -1,16 +1,19 @@
 /* Functions related to the java host instances.                            */
 
-/* Copyright (c) 2007-2012. The SimGrid Team.
+/* Copyright (c) 2007-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. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/str.h"
 #include "xbt/dict.h"
-#include "msg/msg.h"
+#include "simgrid/msg.h"
 #include "jmsg_as.h"
+#include "jmsg_host.h"
 #include "jxbt_utilities.h"
+#include "jmsg.h"
+
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
@@ -137,11 +140,9 @@ Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jobject jas)
   jstring jname;
   msg_host_t host;
   msg_as_t as = jas_get_native(env, jas);
-  printf("t5\n");
 
   xbt_dynar_t table =  MSG_environment_as_get_hosts(as);
   int count = xbt_dynar_length(table);
-  printf("t6-count: %d\n", count);
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
 
@@ -150,36 +151,27 @@ Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jobject jas)
   }
   
   jtable = (*env)->NewObjectArray(env, (jsize) count, cls, NULL);
-  printf("t7\n");
 
   if (!jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return NULL;
   }
-  printf("t8\n");
 
   for (index = 0; index < count; index++) {
-  printf("t9\n");
 
     host = xbt_dynar_get_as(table,index,msg_host_t);
-  printf("t9: %p\n", host);
 
-    jhost = (jobject) (MSG_host_get_data(host));
-  printf("t9\n");
-  printf("name: %s\n", MSG_host_get_name(host));
+    jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL);
     if (!jhost) {
       jname = (*env)->NewStringUTF(env, MSG_host_get_name(host));
-  printf("t10\n");
 
       jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
-  printf("t11\n");
 
       /* FIXME: leak of jname ? */
     }
 
     (*env)->SetObjectArrayElement(env, jtable, index, jhost);
   }
-  printf("t9\n");
   xbt_dynar_free(&table);
   return jtable;
 }