From: coldpeace Date: Mon, 15 Mar 2010 10:40:39 +0000 (+0000) Subject: throw the right exception corresponding to TimeoutFailureException X-Git-Tag: SVN~489 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0ff207b9e492129a12c9e892ee4b9de9d70f3a63 throw the right exception corresponding to TimeoutFailureException git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7250 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/java/jmsg.c b/src/java/jmsg.c index e86c09f8b4..b18f5dfee8 100644 --- a/src/java/jmsg.c +++ b/src/java/jmsg.c @@ -50,7 +50,6 @@ static jobject native_to_java_process(m_process_t process) (process->simdata->s_process->context))->jprocess; } - /* * The MSG process connected functions implementation. */ @@ -170,7 +169,7 @@ Java_simgrid_msg_MsgNative_processResume(JNIEnv * env, jclass cls, 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; } @@ -996,7 +995,9 @@ Java_simgrid_msg_MsgNative_taskSend(JNIEnv * env, jclass cls, else if ( rv == MSG_HOST_FAILURE ) jxbt_throw_host_failure(env,MSG_task_get_name(task),alias); - else + 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")); } diff --git a/src/java/jxbt_utilities.c b/src/java/jxbt_utilities.c index 67eca4fec1..da844c8172 100644 --- a/src/java/jxbt_utilities.c +++ b/src/java/jxbt_utilities.c @@ -282,4 +282,14 @@ void jxbt_throw_host_failure(JNIEnv *env,const char *task_name,const char *alias "simgrid/msg/HostFailureException", bprintf("Host Failure while sending (task :%s / alias %s) : The host on which you are running has just been rebooted",task_name,alias)); +} + +// time out failure Exception +void jxbt_throw_time_out_failure(JNIEnv *env,const char *task_name,const char *alias) +{ + + jxbt_throw_by_name(env, + "simgrid/msg/TimeoutFailureException", + bprintf("Timeout Failure while sending(task :%s / alias %s ):nothing good happened before the timer you provided elapsed ",task_name,alias)); + } \ No newline at end of file diff --git a/src/java/jxbt_utilities.h b/src/java/jxbt_utilities.h index f87391ce9c..dc5416f079 100644 --- a/src/java/jxbt_utilities.h +++ b/src/java/jxbt_utilities.h @@ -79,5 +79,7 @@ void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name); void jxbt_throw_transfer_failure(JNIEnv * env,const char *task_name,const char *alias); /** Thrown when a host failure accures while Sending task*/ void jxbt_throw_host_failure(JNIEnv *env,const char *task_name,const char *alias); +/** Thrown when a time out accures While Sending task */ +void jxbt_throw_time_out_failure(JNIEnv *env,const char *task_name,const char *alias); #endif /* ! JXBT_UTILITY_H */ diff --git a/src/java/simgrid/msg/MsgNative.java b/src/java/simgrid/msg/MsgNative.java index e64718b765..8afd36f093 100644 --- a/src/java/simgrid/msg/MsgNative.java +++ b/src/java/simgrid/msg/MsgNative.java @@ -425,8 +425,7 @@ final class MsgNative { * Communication methods thru mailboxes * **************************************************************** */ - - final static native void taskSend(String alias, Task task, double timeout) throws TransferFailureException,HostFailureException,NativeException; + final static native void taskSend(String alias, Task task, double timeout) throws NativeException,TransferFailureException,HostFailureException,TimeoutFailureException; final static native Task taskReceive(String alias, double timeout, Host host) throws NativeException; final static native int taskListenFrom(String alias) throws NativeException; final static native boolean taskListen(String alias);