#include "jmsg_application_handler.h"
#include "jxbt_utilities.h"
-
#include "jmsg.h"
-
#include "msg/mailbox.h"
-
#include "surf/surfxml_parse.h"
-
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
static JavaVM *__java_vm = NULL;
(process->simdata->s_process->context))->jprocess;
}
-
/*
* The MSG process connected functions implementation.
*/
m_process_t process = jprocess_to_native_process(jprocess, env);
if (!process) {
- jxbt_throw_notbound(env, "process", jprocess);
+ jxbt_throw_notbound(env,"process", jprocess);
return;
}
(*env)->ReleaseStringUTFChars(env, jalias, alias);
- /* FIXME throw the right exception corresponding to HostFailureException, TransferFailureException, TimeoutFailureException
+ /* throw the right exception corresponding to HostFailureException, TransferFailureException, TimeoutFailureException
* Note: these exceptions must be created beforehand
* then, you want to create some functions like jxbt_throw_notbound()
* then, you must declare in the MsgNative stuff that these native functions can throw these exceptions
*/
if (MSG_OK != rv)
- jxbt_throw_native(env, xbt_strdup("MSG_task_send_with_timeout() failed"));
-
+ {
+
+ if ( rv == MSG_TRANSFER_FAILURE )
+ jxbt_throw_transfer_failure(env,MSG_task_get_name(task),alias);
+
+ else if ( rv == MSG_HOST_FAILURE )
+ jxbt_throw_host_failure(env,MSG_task_get_name(task),alias);
+
+ else if ( rv == MSG_TIMEOUT_FAILURE )
+ jxbt_throw_time_out_failure(env,MSG_task_get_name(task),alias);
+ else
+ jxbt_throw_native(env, xbt_strdup("MSG_task_send_with_timeout() failed"));
+
+ }
}
JNIEXPORT void JNICALL
Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv * env, jclass cls,
jstring jalias, jobject jhost)
{
-
int rv;
const char *alias;
jxbt_throw_notbound(env, "host", jhost);
return -1;
}
-
alias = (*env)->GetStringUTFChars(env, jalias, 0);
rv = MSG_task_listen_from_host(alias, host);