Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove host data and had JAVA_HOST_LEVEL
[simgrid.git] / src / bindings / java / jmsg_task.c
index 01c30ce..77aa315 100644 (file)
@@ -1,10 +1,10 @@
 /* Functions related to the java task instances.                            */
 
-/* Copyright (c) 2007, 2009-2010, 2013. The SimGrid Team.
+/* Copyright (c) 2007, 2009-2010, 2013-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 "jmsg.h"
 
@@ -225,6 +225,18 @@ Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
   }
 }
 
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_Task_setBound(JNIEnv * env, jobject jtask, jdouble load)
+{
+  msg_task_t task = jtask_to_native_task(jtask, env);
+
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
+    return;
+  }
+  MSG_task_set_bound(task, load);
+}
+
 JNIEXPORT jstring JNICALL
 Java_org_simgrid_msg_Task_getName(JNIEnv * env,
                                        jobject jtask) {
@@ -273,12 +285,12 @@ Java_org_simgrid_msg_Task_getSource(JNIEnv * env,
   if (host == NULL) {
        return NULL;
   }
-  if (!MSG_host_get_data(host)) {
+  if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) {
     jxbt_throw_jni(env, "MSG_task_get_source() failed");
     return NULL;
   }
 
-  return (jobject) MSG_host_get_data(host);
+  return (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL);
 }
 
 JNIEXPORT jdouble JNICALL