Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix in Comm (GC didn't like it.). Add "debug" logging
[simgrid.git] / src / jmsg.c
index 1e02578..7ace464 100644 (file)
@@ -49,6 +49,24 @@ JNIEnv *get_current_thread_env(void)
   (*__java_vm)->AttachCurrentThread(__java_vm, (void **) &env, NULL);
   return env;
 }
+
+void jmsg_throw_status(JNIEnv *env, MSG_error_t status) {
+       switch (status) {
+               case MSG_TIMEOUT:
+                       jxbt_throw_time_out_failure(env,NULL);
+               break;
+               case MSG_TRANSFER_FAILURE:
+                       jxbt_throw_transfer_failure(env,NULL);
+               break;
+               case MSG_HOST_FAILURE:
+                       jxbt_throw_host_failure(env,NULL);
+               break;
+               default:
+                       jxbt_throw_native(env,bprintf("communication failed"));
+       }
+}
+
+
 /***************************************************************************************
  * Unsortable functions                                                        *
  ***************************************************************************************/
@@ -149,7 +167,13 @@ Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls,
 
   (*env)->ReleaseStringUTFChars(env, jplatformFile, platformFile);
 }
-
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_Msg_debug(JNIEnv * env, jclass cls, jstring js)
+{
+  const char *s = (*env)->GetStringUTFChars(env, js, 0);
+  XBT_DEBUG("%s", s);
+  (*env)->ReleaseStringUTFChars(env, js, s);
+}
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_Msg_info(JNIEnv * env, jclass cls, jstring js)
 {