XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
+jfieldID jprocess_field_Process_bind;
+jfieldID jprocess_field_Process_host;
+jfieldID jprocess_field_Process_killTime;
+jfieldID jprocess_field_Process_id;
+jfieldID jprocess_field_Process_name;
+jfieldID jprocess_field_Process_pid;
+jfieldID jprocess_field_Process_ppid;
+
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Process_exit(JNIEnv *env, jobject jprocess) {
if (smx_factory_initializer_to_use == SIMIX_ctx_cojava_factory_init) {
msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
{
- return (msg_process_t) (long) (*env)->GetLongField(env, jprocess, jprocess_field_Process_bind);
+ return
+ (msg_process_t)(intptr_t)(*env)->GetLongField(env, jprocess,
+ jprocess_field_Process_bind);
}
void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env)
{
- (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind, (jlong)(process));
+ (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind,
+ (intptr_t)process);
}
jlong jprocess_get_id(jobject jprocess, JNIEnv * env)
{
- return (*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
+ return
+ (intptr_t)(*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
}
jstring jprocess_get_name(jobject jprocess, JNIEnv * env)
/* bind/retrieve the msg host */
host = MSG_get_host_by_name(hostname);
- if (!(host)) { /* not binded */
+ if (!(host)) { /* not bound */
jxbt_throw_host_not_found(env, hostname);
return;
}
{
msg_error_t rv;
rv = MSG_process_sleep((double)jseconds);
+ if ((*env)->ExceptionOccurred(env))
+ return;
if (rv != MSG_OK) {
- XBT_INFO("Status NOK");
+ XBT_DEBUG("Status NOK");
jmsg_throw_status(env,rv);
}
}
msg_error_t rv = MSG_process_migrate(process, host);
if (rv != MSG_OK) {
jmsg_throw_status(env,rv);
+ return;
}
/* change the host java side */
(*env)->SetObjectField(env, jprocess, jprocess_field_Process_host, jhost);