Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
throw the right exception corresponding to TimeoutFailureException
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 15 Mar 2010 10:40:39 +0000 (10:40 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 15 Mar 2010 10:40:39 +0000 (10:40 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7250 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/java/jmsg.c
src/java/jxbt_utilities.c
src/java/jxbt_utilities.h
src/java/simgrid/msg/MsgNative.java

index e86c09f..b18f5df 100644 (file)
@@ -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"));
   
   } 
index 67eca4f..da844c8 100644 (file)
@@ -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
index f87391c..dc5416f 100644 (file)
@@ -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 */
index e64718b..8afd36f 100644 (file)
@@ -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);