Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java process creation: this was already binded by java_main_jprocess()
[simgrid.git] / src / bindings / java / jmsg_process.cpp
index f914fc8..9caba49 100644 (file)
@@ -26,7 +26,7 @@ jobject jprocess_from_native(msg_process_t process)
 {
   simgrid::kernel::context::JavaContext* context =
       (simgrid::kernel::context::JavaContext*)process->get_impl()->context_;
-  return context->jprocess;
+  return context->jprocess_;
 }
 
 jobject jprocess_ref(jobject jprocess, JNIEnv* env)
@@ -77,9 +77,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
                                       /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr);
   env->ReleaseStringUTFChars(jname, name);
 
-  /* bind the java process instance to the native process */
-  jprocess_bind(jprocess, process, env);
-
   /* Retrieve the kill time from the process */
   jdouble jkill = env->GetDoubleField(jprocess, jprocess_field_Process_killTime);
   MSG_process_set_kill_time(process, (double)jkill);
@@ -226,7 +223,11 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cl
  {
   double time =  ((double)jmillis) / 1000 + ((double)jnanos) / 1000000000;
   msg_error_t rv;
-  rv = MSG_process_sleep(time);
+  try {
+    rv = MSG_process_sleep(time);
+  } catch (simgrid::kernel::context::Context::StopRequest const&) {
+    rv = MSG_HOST_FAILURE;
+  }
   if (rv != MSG_OK) {
     XBT_DEBUG("Something during the MSG_process_sleep invocation was wrong, trigger a HostFailureException");