jfieldID jprocess_field_Process_bind;
jfieldID jprocess_field_Process_host;
jfieldID jprocess_field_Process_killTime;
jfieldID jprocess_field_Process_bind;
jfieldID jprocess_field_Process_host;
jfieldID jprocess_field_Process_killTime;
- return ((smx_ctx_java_t)MSG_process_get_smx_ctx(process))->jprocess;
+ simgrid::java::JavaContext* context =
+ (simgrid::java::JavaContext*) MSG_process_get_smx_ctx(process);
+ return context->jprocess;
}
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);
xbt_os_thread_join(context->thread,NULL);
}
msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
{
return
xbt_os_thread_join(context->thread,NULL);
}
msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
{
return
jprocess_field_Process_bind);
}
void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env)
{
jprocess_field_Process_bind);
}
void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env)
{
- (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind,
+ env->SetLongField(jprocess, jprocess_field_Process_bind,
- jstring jname = (jstring) (*env)->GetObjectField(env, jprocess, jprocess_field_Process_name);
- return (*env)->NewGlobalRef(env, jname);
-
+ jstring jname = (jstring) env->GetObjectField(jprocess, jprocess_field_Process_name);
+ return (jstring) env->NewGlobalRef(jname);
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");
msg_process_t process; /* the native process to create */
msg_host_t host; /* Where that process lives */
msg_process_t process; /* the native process to create */
msg_host_t host; /* Where that process lives */
/* get the name of the java process */
jname = jprocess_get_name(jprocess_arg, env);
/* get the name of the java process */
jname = jprocess_get_name(jprocess_arg, env);
/* Actually build the MSG process */
process = MSG_process_create_with_environment(name,
(xbt_main_func_t) jprocess,
/* Actually build the MSG process */
process = MSG_process_create_with_environment(name,
(xbt_main_func_t) jprocess,
/* release our reference to the process name (variable name becomes invalid) */
//FIXME : This line should be uncommented but with mac it doesn't work. BIG WARNING
/* release our reference to the process name (variable name becomes invalid) */
//FIXME : This line should be uncommented but with mac it doesn't work. BIG WARNING
- //(*env)->ReleaseStringUTFChars(env, jname, name);
- (*env)->ReleaseStringUTFChars(env, jhostname, hostname);
+ //env->ReleaseStringUTFChars(jname, name);
+ env->ReleaseStringUTFChars((jstring) jhostname, hostname);
- (*env)->SetIntField(env, jprocess, jprocess_field_Process_pid,(jint) MSG_process_get_PID(process));
- (*env)->SetIntField(env, jprocess, jprocess_field_Process_ppid, (jint) MSG_process_get_PPID(process));
+ env->SetIntField(jprocess, jprocess_field_Process_pid,(jint) MSG_process_get_PID(process));
+ env->SetIntField(jprocess, jprocess_field_Process_ppid, (jint) MSG_process_get_PPID(process));
- (*env)->SetObjectField(env, jprocess, jprocess_field_Process_host, jhost);
+ env->SetObjectField(jprocess, jprocess_field_Process_host, jhost);
- // adsein, the code above as been replaced by the code below. Indeed, according to the documentation, a sleep can only
+ // adsein, the code above as been replaced by the code below. Indeed, according to the documentation, a sleep can only
// trigger a host_failure exception. When the sleep crashes due to a host shutdown, the exception thrown by smx_context_java.c
// is a cancelled_error, see bindings/java/smx_context_java.c, function void smx_ctx_java_stop(smx_context_t context) and src/msg/msg_gos.c
// function msg_error_t MSG_process_sleep(double nb_sec)
// trigger a host_failure exception. When the sleep crashes due to a host shutdown, the exception thrown by smx_context_java.c
// is a cancelled_error, see bindings/java/smx_context_java.c, function void smx_ctx_java_stop(smx_context_t context) and src/msg/msg_gos.c
// function msg_error_t MSG_process_sleep(double nb_sec)
- (*env)->SetObjectField(env, jprocess, jprocess_field_Process_host, jhost);
+ env->SetObjectField(jprocess, jprocess_field_Process_host, jhost);
Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls) {
return (jint) MSG_process_get_number();
}
Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls) {
return (jint) MSG_process_get_number();
}