Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
allow java actors to kill themselves
[simgrid.git] / src / bindings / java / jmsg_process.cpp
index 374f714..6ec0684 100644 (file)
@@ -27,11 +27,6 @@ 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) {
-
-}
-
 jobject native_to_java_process(msg_process_t process)
 {
   simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
@@ -144,7 +139,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject
   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 {
-              smx_process_t process = SIMIX_process_self();
+              smx_actor_t process = SIMIX_process_self();
               // 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);
@@ -354,7 +349,11 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill(JNIEnv * env, jobject j
     return;
   }
 
-  MSG_process_kill(process);
+  try {
+    MSG_process_kill(process);
+  } catch (xbt_ex& ex) {
+    XBT_VERB("This process just killed itself.");
+  }
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobject jprocess, jobject jhost)