/* 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. */
/* 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. */
void jprocess_join(jobject jprocess, JNIEnv * env)
{
msg_process_t process = jprocess_to_native_process(jprocess,env);
void jprocess_join(jobject jprocess, JNIEnv * env)
{
msg_process_t process = jprocess_to_native_process(jprocess,env);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls) {
jclass jprocess_class_Process = env->FindClass("org/simgrid/msg/Process");
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls) {
jclass jprocess_class_Process = env->FindClass("org/simgrid/msg/Process");
jprocess_field_Process_name = jxbt_get_jfield(env, jprocess_class_Process, "name", "Ljava/lang/String;");
jprocess_field_Process_bind = jxbt_get_jfield(env, jprocess_class_Process, "bind", "J");
jprocess_field_Process_name = jxbt_get_jfield(env, jprocess_class_Process, "name", "Ljava/lang/String;");
jprocess_field_Process_bind = jxbt_get_jfield(env, jprocess_class_Process, "bind", "J");
jprocess_field_Process_ppid = jxbt_get_jfield(env, jprocess_class_Process, "ppid", "I");
jprocess_field_Process_host = jxbt_get_jfield(env, jprocess_class_Process, "host", "Lorg/simgrid/msg/Host;");
jprocess_field_Process_killTime = jxbt_get_jfield(env, jprocess_class_Process, "killTime", "D");
jprocess_field_Process_ppid = jxbt_get_jfield(env, jprocess_class_Process, "ppid", "I");
jprocess_field_Process_host = jxbt_get_jfield(env, jprocess_class_Process, "host", "Lorg/simgrid/msg/Host;");
jprocess_field_Process_killTime = jxbt_get_jfield(env, jprocess_class_Process, "killTime", "D");
- if (!jprocess_class_Process || !jprocess_field_Process_id || !jprocess_field_Process_name ||
- !jprocess_field_Process_pid || !jprocess_field_Process_ppid || !jprocess_field_Process_host) {
- jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
- }
+ xbt_assert(jprocess_field_Process_id && jprocess_field_Process_name && jprocess_field_Process_pid &&
+ jprocess_field_Process_ppid && jprocess_field_Process_host,
+ "Native initialization of msg/Process failed. Please report that bug");
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject jprocess_arg, jobject jhostname)
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject jprocess_arg, jobject jhostname)
jdouble jkill = env->GetDoubleField(jprocess, jprocess_field_Process_killTime);
/* Actually build the MSG process */
process = MSG_process_create_with_environment(name, [](int argc, char** argv) -> int {
jdouble jkill = env->GetDoubleField(jprocess, jprocess_field_Process_killTime);
/* Actually build the MSG process */
process = MSG_process_create_with_environment(name, [](int argc, char** argv) -> int {
// This is the jprocess passed as environment.
// It would be simplet if we could use a closure.
jobject jprocess = (jobject) MSG_process_get_data(process);
// This is the jprocess passed as environment.
// It would be simplet if we could use a closure.
jobject jprocess = (jobject) MSG_process_get_data(process);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobject jprocess, jobject jhost)
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobject jprocess, jobject jhost)
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime (JNIEnv *env , jobject jprocess, jdouble jkilltime) {
msg_process_t process = jprocess_to_native_process(jprocess, env);
MSG_process_set_kill_time(process, (double)jkilltime);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime (JNIEnv *env , jobject jprocess, jdouble jkilltime) {
msg_process_t process = jprocess_to_native_process(jprocess, env);
MSG_process_set_kill_time(process, (double)jkilltime);