X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/43d5e0b63aa3e781f8326674a7de4860b9df1366..c826aea97f55975f029422aa2a9cfdabf4846384:/src/bindings/java/jmsg.cpp diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 50639d9ea8..868c517197 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -71,7 +70,8 @@ void jmsg_throw_status(JNIEnv *env, msg_error_t status) { jxbt_throw_task_cancelled(env,NULL); break; default: - jxbt_throw_native(env,xbt_strdup("undefined message failed (please see jmsg_throw_status function in jmsg.c)")); + jxbt_throw_native(env,xbt_strdup("undefined message failed " + "(please see jmsg_throw_status function in jmsg.cpp)")); } } @@ -133,8 +133,8 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) MSG_init(&argc, argv); - JAVA_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __JAVA_host_priv_free); - JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __JAVA_storage_priv_free); + JAVA_HOST_LEVEL = simgrid::s4u::Host::extension_create(__JAVA_host_priv_free); + JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, __JAVA_storage_priv_free); for (index = 0; index < argc; index++) free(argv[index]); @@ -156,7 +156,8 @@ JNIEXPORT void JNICALL /* Cleanup java hosts */ xbt_dynar_t hosts = MSG_hosts_as_dynar(); for (unsigned long index = 0; index < xbt_dynar_length(hosts) - 1; index++) { - jobject jhost = (jobject) xbt_lib_get_level(xbt_dynar_get_as(hosts,index,msg_host_t), JAVA_HOST_LEVEL); + msg_host_t msg_host = xbt_dynar_get_as(hosts,index,msg_host_t); + jobject jhost = (jobject) msg_host->extension(JAVA_HOST_LEVEL); if (jhost) jhost_unref(env, jhost); @@ -357,3 +358,10 @@ void java_main_jprocess(jobject jprocess) } } + + +#include "simgrid/plugins/energy.h" +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Msg_energyInit(void) { + sg_energy_plugin_init(); +}