Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
removing NativeExpection and adding others
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Mar 2010 10:43:36 +0000 (10:43 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Mar 2010 10:43:36 +0000 (10:43 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7308 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/java/jmsg.c
src/java/jxbt_utilities.c
src/java/jxbt_utilities.h
src/java/simgrid/msg/ApplicationHandler.java
src/java/simgrid/msg/Host.java
src/java/simgrid/msg/MsgNative.java
src/java/simgrid/msg/Process.java
src/java/simgrid/msg/Task.java

index 2f22893..8b57c1c 100644 (file)
@@ -158,8 +158,11 @@ Java_simgrid_msg_MsgNative_processSuspend(JNIEnv * env, jclass cls,
   }
 
   /* try to suspend the process */
   }
 
   /* try to suspend the process */
-  if (MSG_OK != MSG_process_suspend(process))
-    jxbt_throw_native(env, xbt_strdup("MSG_process_suspend() failed"));
+  MSG_error_t rv = MSG_process_suspend(process);
+  
+  jxbt_check_res("MSG_process_suspend()",rv,MSG_OK,
+    bprintf("unexpected error , please report this bug"));
+  
 }
 
 JNIEXPORT void JNICALL
 }
 
 JNIEXPORT void JNICALL
@@ -174,8 +177,10 @@ Java_simgrid_msg_MsgNative_processResume(JNIEnv * env, jclass cls,
   }
 
   /* try to resume the process */
   }
 
   /* try to resume the process */
-  if (MSG_OK != MSG_process_resume(process))
-    jxbt_throw_native(env, xbt_strdup("MSG_process_resume() failed"));
+    MSG_error_t rv = MSG_process_resume(process);
+    
+    jxbt_check_res("MSG_process_resume()",rv,MSG_OK,
+    bprintf("unexpected error , please report this bug"));
 }
 
 JNIEXPORT jboolean JNICALL
 }
 
 JNIEXPORT jboolean JNICALL
@@ -326,10 +331,11 @@ JNIEXPORT void JNICALL
 Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv * env, jclass cls,
                                           jdouble seconds)
 {
 Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv * env, jclass cls,
                                           jdouble seconds)
 {
-  if (MSG_OK != MSG_process_sleep((double) seconds))
-    jxbt_throw_native(env,
-                      bprintf("MSG_process_change_host(%f) failed",
-                              (double) seconds));
+    MSG_error_t rv= MSG_process_sleep((double) seconds);
+    
+    jxbt_check_res("MSG_process_sleep()",rv, MSG_HOST_FAILURE,
+    bprintf("while process was waiting for %f seconds",(double)seconds));
+    
 }
 
 
 }
 
 
@@ -656,7 +662,7 @@ Java_simgrid_msg_MsgNative_taskGetSource(JNIEnv * env, jclass cls,
   host = MSG_task_get_source(task);
 
   if (!host->data) {
   host = MSG_task_get_source(task);
 
   if (!host->data) {
-    jxbt_throw_native(env, xbt_strdup("MSG_task_get_source() failed"));
+    jxbt_throw_jni(env, "MSG_task_get_source() failed");
     return NULL;
   }
 
     return NULL;
   }
 
@@ -688,8 +694,10 @@ Java_simgrid_msg_MsgNative_taskCancel(JNIEnv * env, jclass cls, jobject jtask)
     return;
   }
 
     return;
   }
 
-  if (MSG_OK != MSG_task_cancel(ptask))
-    jxbt_throw_native(env, xbt_strdup("MSG_task_cancel() failed"));
+  MSG_error_t rv = MSG_task_cancel(ptask);
+  
+    jxbt_check_res("MSG_task_cancel()",rv,MSG_OK,
+    bprintf("unexpected error , please report this bug"));
 }
 
 JNIEXPORT jdouble JNICALL
 }
 
 JNIEXPORT jdouble JNICALL
@@ -745,9 +753,12 @@ Java_simgrid_msg_MsgNative_taskDestroy(JNIEnv * env, jclass cls,
     return;
   }
   jtask = (jobject) task->data;
     return;
   }
   jtask = (jobject) task->data;
+    
+  MSG_error_t rv = MSG_task_destroy(task);
+    
+  jxbt_check_res("MSG_task_destroy()",rv,MSG_OK,
+    bprintf("unexpected error , please report this bug"));
 
 
-  if (MSG_OK != MSG_task_destroy(task))
-    jxbt_throw_native(env, xbt_strdup("MSG_task_destroy() failed"));
 
   /* delete the global reference to the java task object */
   jtask_delete_global_ref(jtask, env);
 
   /* delete the global reference to the java task object */
   jtask_delete_global_ref(jtask, env);
@@ -764,8 +775,10 @@ Java_simgrid_msg_MsgNative_taskExecute(JNIEnv * env, jclass cls,
     return;
   }
 
     return;
   }
 
-  if (MSG_OK != MSG_task_execute(task))
-    jxbt_throw_native(env, xbt_strdup("MSG_task_execute() failed"));
+  MSG_error_t rv = MSG_task_execute(task);
+  
+    jxbt_check_res("MSG_task_execute()",rv,MSG_HOST_FAILURE|MSG_TASK_CANCELLED,
+    bprintf("while executing task %s", MSG_task_get_name(task)));
 }
 
 /***************************************************************************************
 }
 
 /***************************************************************************************
@@ -1005,8 +1018,9 @@ Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv * env, jclass cls,
 
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
 
 
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
 
-  if (MSG_OK != rv)
-    jxbt_throw_native(env, xbt_strdup("MSG_task_send_bounded() failed"));
+  jxbt_check_res("MSG_task_send_bounded()",rv, MSG_HOST_FAILURE|MSG_TRANSFER_FAILURE|MSG_TIMEOUT_FAILURE,
+    bprintf("while sending task %s to mailbox %s with max rate %f", MSG_task_get_name(task),alias,(double)jmaxRate));
+    
 }
 
 JNIEXPORT jobject JNICALL
 }
 
 JNIEXPORT jobject JNICALL
@@ -1034,10 +1048,8 @@ Java_simgrid_msg_MsgNative_taskReceive(JNIEnv * env, jclass cls,
 
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
 
 
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
 
-  if (MSG_OK != rv) {
-    jxbt_throw_native(env, xbt_strdup("MSG_task_receive_ext() failed"));
-    return NULL;
-  }
+  jxbt_check_res("MSG_task_receive_ext()",rv, MSG_HOST_FAILURE|MSG_TRANSFER_FAILURE|MSG_TIMEOUT_FAILURE,
+    bprintf("while receiving from mailbox %s",alias));
 
   return (jobject) task->data;
 }
 
   return (jobject) task->data;
 }
index 9649bd6..43047a6 100644 (file)
@@ -290,3 +290,13 @@ void jxbt_throw_time_out_failure(JNIEnv *env,char *details) {
                    details);
   
 }
                    details);
   
 }
+
+// task Cancelled exception
+void jxbt_throw_task_cancelled(JNIEnv *env,char *details)
+{
+  jxbt_throw_by_name(env,
+                    "simgrid/msg/TaskCancelledException",
+                    details);
+  
+}
\ No newline at end of file
index 4d6dd03..699e4f6 100644 (file)
@@ -65,6 +65,8 @@ jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname,
       jxbt_throw_transfer_failure(env,detail); \
     } else if (res == MSG_TIMEOUT_FAILURE) { \
       jxbt_throw_time_out_failure(env,detail); \
       jxbt_throw_transfer_failure(env,detail); \
     } else if (res == MSG_TIMEOUT_FAILURE) { \
       jxbt_throw_time_out_failure(env,detail); \
+    } else if (res == MSG_TASK_CANCELLED){ \
+      jxbt_throw_task_cancelled(env,detail); \
    } } while (0)
 
 /** Thrown on internal error of this layer, or on problem with JNI */
    } } while (0)
 
 /** Thrown on internal error of this layer, or on problem with JNI */
@@ -90,5 +92,7 @@ void jxbt_throw_transfer_failure(JNIEnv * env,char *detail);
 void jxbt_throw_host_failure(JNIEnv *env,char *details);
 /** Thrown when a time out accures While Sending task */
 void jxbt_throw_time_out_failure(JNIEnv *env,char *details);
 void jxbt_throw_host_failure(JNIEnv *env,char *details);
 /** Thrown when a time out accures While Sending task */
 void jxbt_throw_time_out_failure(JNIEnv *env,char *details);
+/**Thrown when a task is canceled */
+void jxbt_throw_task_cancelled(JNIEnv *env,char *details);
 
 #endif /* ! JXBT_UTILITY_H */
 
 #endif /* ! JXBT_UTILITY_H */
index 82d38e8..ef245d7 100644 (file)
@@ -96,10 +96,6 @@ public final class ApplicationHandler {
                                 process.properties = properties;
                                 properties = new Hashtable();
 
                                 process.properties = properties;
                                 properties = new Hashtable();
 
-                        } catch(NativeException e) {
-                                System.out.println(e.toString());
-                                e.printStackTrace();
-
                         } catch(HostNotFoundException e) {
                                 System.out.println(e.toString());
                                 e.printStackTrace();
                         } catch(HostNotFoundException e) {
                                 System.out.println(e.toString());
                                 e.printStackTrace();
index 9dd9f4b..ffe8b41 100644 (file)
@@ -72,7 +72,7 @@ public class Host {
         *                                      NativeException if the native version of this method failed.
         */ 
        public static Host getByName(String name) 
         *                                      NativeException if the native version of this method failed.
         */ 
        public static Host getByName(String name) 
-       throws HostNotFoundException, NativeException {
+       throws HostNotFoundException {
                if (name==null)
                        throw new NullPointerException("No host can have a null name");
                return MsgNative.hostGetByName(name);
                if (name==null)
                        throw new NullPointerException("No host can have a null name");
                return MsgNative.hostGetByName(name);
@@ -84,7 +84,7 @@ public class Host {
         * @return                      The count of the installed hosts.
         *
         */ 
         * @return                      The count of the installed hosts.
         *
         */ 
-       public static int getCount() throws NativeException {
+       public static int getCount() {
                return MsgNative.hostGetCount();
        }
 
                return MsgNative.hostGetCount();
        }
 
@@ -102,9 +102,8 @@ public class Host {
         *
         * @return                      An array containing all the hosts installed.
         *
         *
         * @return                      An array containing all the hosts installed.
         *
-        * @exception           NativeException if the native version of this method failed.
         */ 
         */ 
-       public static Host[] all() throws NativeException {
+       public static Host[] all()  {
                return MsgNative.allHosts();
        }
 
                return MsgNative.allHosts();
        }
 
@@ -113,9 +112,8 @@ public class Host {
         *
         * @return                      The name of the host.
         *
         *
         * @return                      The name of the host.
         *
-        * @exception           NativeException FIXME: check when
         */ 
         */ 
-       public String getName() throws NativeException {
+       public String getName()  {
                return MsgNative.hostGetName(this);
        }
 
                return MsgNative.hostGetName(this);
        }
 
index c31ab49..aa7a3b9 100644 (file)
@@ -69,11 +69,10 @@ final class MsgNative {
         *
         * @param process        The valid (binded with a native process) java process to resume.
         *
         *
         * @param process        The valid (binded with a native process) java process to resume.
         *
-        * @exception            NativeException if the SimGrid native code failed.
         *
         * @see                 Process.restart()
         */
         *
         * @see                 Process.restart()
         */
-       final static native void processResume(Process process) throws NativeException;
+       final static native void processResume(Process process);
 
        /**
         * The natively implemented method to test if MSG process is suspended.
 
        /**
         * The natively implemented method to test if MSG process is suspended.
@@ -150,12 +149,11 @@ final class MsgNative {
         * @param process        The (valid) process to migrate.
         * @param host            A (valid) host where move the process.
         *
         * @param process        The (valid) process to migrate.
         * @param host            A (valid) host where move the process.
         *
-        * @exception            NativeException if the SimGrid native code failed.
         *
         * @see                Process.migrate()
         * @see                Host.getByName()
         */
         *
         * @see                Process.migrate()
         * @see                Host.getByName()
         */
-       final static native void processChangeHost(Process process, Host host) throws NativeException;
+       final static native void processChangeHost(Process process, Host host) ;
 
        /**
         * The natively implemented native to request the current process to sleep 
 
        /**
         * The natively implemented native to request the current process to sleep 
@@ -163,11 +161,11 @@ final class MsgNative {
         *
         * @param seconds        The time the current process must sleep.
         *
         *
         * @param seconds        The time the current process must sleep.
         *
-        * @exception            NativeException if the SimGrid native code failed.
+        * @exception            HostFailureException if the SimGrid native code failed.
         *
         * @see                 Process.waitFor()
         */
         *
         * @see                 Process.waitFor()
         */
-       final static native void processWaitFor(double seconds) throws NativeException;
+       final static native void processWaitFor(double seconds) throws HostFailureException;
 
        /**
         * The natively implemented native method to exit a process.
 
        /**
         * The natively implemented native method to exit a process.
@@ -189,11 +187,11 @@ final class MsgNative {
         * @return                The host having the specified name.
         *
         * @exception            HostNotFoundException if there is no such host
         * @return                The host having the specified name.
         *
         * @exception            HostNotFoundException if there is no such host
-        *                       NativeException if the SimGrid native code failed.
+        *                       
         *
         * @see                Host.getByName()
         */
         *
         * @see                Host.getByName()
         */
-       final static native Host hostGetByName(String name) throws HostNotFoundException, NativeException;
+       final static native Host hostGetByName(String name) throws HostNotFoundException;
 
        /**
         * The natively implemented method to get the name of an MSG host.
 
        /**
         * The natively implemented method to get the name of an MSG host.
@@ -309,11 +307,10 @@ final class MsgNative {
         *
         * @return                The source of the task.
         *
         *
         * @return                The source of the task.
         *
-        * @exception            NativeException if the SimGrid native code failed.
         *
         * @see                    Task.getSource()
         */
         *
         * @see                    Task.getSource()
         */
-       final static native Host taskGetSource(Task task) throws NativeException;
+       final static native Host taskGetSource(Task task);
 
        /**
         * The natively implemented method to get the name of the task.
 
        /**
         * The natively implemented method to get the name of the task.
@@ -331,11 +328,10 @@ final class MsgNative {
         *
         * @param task            The task to cancel.
         *
         *
         * @param task            The task to cancel.
         *
-        * @exception             NativeException if the cancellation failed.
         *
         * @see                    Task.cancel().
         */
         *
         * @see                    Task.cancel().
         */
-       final static native void taskCancel(Task task) throws NativeException;
+       final static native void taskCancel(Task task);
 
        /**
         * The natively implemented method to create a MSG parallel task.
 
        /**
         * The natively implemented method to create a MSG parallel task.
@@ -392,30 +388,29 @@ final class MsgNative {
         *
         * @param                    The task to destroy.
         *
         *
         * @param                    The task to destroy.
         *
-        * @exception             NativeException on error in the C world
         *
         * @see                    Task.destroy()
         */
         *
         * @see                    Task.destroy()
         */
-       final static native void taskDestroy(Task task) throws NativeException;
+       final static native void taskDestroy(Task task) ;
 
        /**
         * The natively implemented method to execute a MSG task.
         *
         * @param task            The task to execute.
         *
 
        /**
         * The natively implemented method to execute a MSG task.
         *
         * @param task            The task to execute.
         *
-        * @exception             NativeException on error in the C world
+        * @exception             HostFailureException,TaskCancelledException on error in the C world
         *
         * @see                    Task.execute()
         */
         *
         * @see                    Task.execute()
         */
-       final static native void taskExecute(Task task) throws NativeException;
+       final static native void taskExecute(Task task) throws HostFailureException,TaskCancelledException;
 
        /* ****************************************************************
         * Communication methods thru mailboxes                           *
         **************************************************************** */
 
 
        /* ****************************************************************
         * Communication methods thru mailboxes                           *
         **************************************************************** */
 
-       final static native void taskSend(String alias, Task task, double timeout) throws NativeException,TransferFailureException,HostFailureException,TimeoutException;
-       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 void taskSend(String alias, Task task, double timeout) throws TransferFailureException,HostFailureException,TimeoutException;
+       final static native Task taskReceive(String alias, double timeout, Host host) throws TransferFailureException,HostFailureException,TimeoutException;
+       final static native int taskListenFrom(String alias);
        final static native boolean taskListen(String alias);
        final static native int taskListenFromHost(String alias, Host host);
 
        final static native boolean taskListen(String alias);
        final static native int taskListenFromHost(String alias, Host host);
 
@@ -433,6 +428,6 @@ final class MsgNative {
         *
         * @exception             NativeException on error in the C world
         */ 
         *
         * @exception             NativeException on error in the C world
         */ 
-       final static native void taskSendBounded(String alias, Task task, double maxrate) throws NativeException;
+       final static native void taskSendBounded(String alias, Task task, double maxrate) throws TransferFailureException,HostFailureException,TimeoutException;
 
 }
\ No newline at end of file
 
 }
\ No newline at end of file
index 0fdc662..0a49369 100644 (file)
@@ -104,10 +104,10 @@ public abstract class Process extends Thread {
         * @param name                  The name of the process.
         *
         * @exception                   HostNotFoundException  if no host with this name exists.
         * @param name                  The name of the process.
         *
         * @exception                   HostNotFoundException  if no host with this name exists.
-        *                      NativeException
+        *                      
         *
         */
         *
         */
-       public Process(String hostname, String name) throws HostNotFoundException, NativeException {
+       public Process(String hostname, String name) throws HostNotFoundException {
                this(Host.getByName(hostname), name, null);
        }
        /**
                this(Host.getByName(hostname), name, null);
        }
        /**
@@ -190,19 +190,17 @@ public abstract class Process extends Thread {
         * Suspends the process by suspending the task on which it was
         * waiting for the completion.
         *
         * Suspends the process by suspending the task on which it was
         * waiting for the completion.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         */
         */
-       public void pause() throws NativeException {
+       public void pause() {
                MsgNative.processSuspend(this);
        }
        /**
         * Resumes a suspended process by resuming the task on which it was
         * waiting for the completion.
         *
                MsgNative.processSuspend(this);
        }
        /**
         * Resumes a suspended process by resuming the task on which it was
         * waiting for the completion.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         *
         */ 
         *
         */ 
-       public void restart() throws NativeException {
+       public void restart()  {
                MsgNative.processResume(this);
        }
        /**
                MsgNative.processResume(this);
        }
        /**
@@ -242,9 +240,8 @@ public abstract class Process extends Thread {
         *
         * @return                              The PID of the process.
         *
         *
         * @return                              The PID of the process.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         */ 
         */ 
-       public int getPID() throws NativeException {
+       public int getPID()  {
                return MsgNative.processGetPID(this);
        }
        /**
                return MsgNative.processGetPID(this);
        }
        /**
@@ -252,9 +249,8 @@ public abstract class Process extends Thread {
         *
         * @return                              The PID of the parent of the process.
         *
         *
         * @return                              The PID of the parent of the process.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         */ 
         */ 
-       public int getPPID() throws NativeException {
+       public int getPPID()  {
                return MsgNative.processGetPPID(this);
        }
        /**
                return MsgNative.processGetPPID(this);
        }
        /**
@@ -262,9 +258,8 @@ public abstract class Process extends Thread {
         *
         * @return                              The current process.
         *
         *
         * @return                              The current process.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         */ 
         */ 
-       public static Process currentProcess() throws NativeException {
+       public static Process currentProcess()  {
                return MsgNative.processSelf();
        }
        /**
                return MsgNative.processSelf();
        }
        /**
@@ -272,9 +267,8 @@ public abstract class Process extends Thread {
         *
         * @param host                  The host where to migrate the process.
         *
         *
         * @param host                  The host where to migrate the process.
         *
-        * @exception                   NativeException on error in the native SimGrid code
         */
         */
-       public void migrate(Host host) throws NativeException {
+       public void migrate(Host host)  {
                MsgNative.processChangeHost(this, host);
        }
        /**
                MsgNative.processChangeHost(this, host);
        }
        /**
@@ -282,9 +276,9 @@ public abstract class Process extends Thread {
         *
         * @param seconds               The time the current process must sleep.
         *
         *
         * @param seconds               The time the current process must sleep.
         *
-        * @exception                   NativeException on error in the native SimGrid code
+        * @exception                   HostFailureException on error in the native SimGrid code
         */ 
         */ 
-       public static void waitFor(double seconds) throws NativeException {
+       public static void waitFor(double seconds) throws HostFailureException {
                MsgNative.processWaitFor(seconds);
        } 
        public void showArgs() {
                MsgNative.processWaitFor(seconds);
        } 
        public void showArgs() {
@@ -357,7 +351,7 @@ public abstract class Process extends Thread {
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException */
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException */
-       public void taskSend(String mailbox, Task task, double timeout) throws NativeException, TransferFailureException, HostFailureException, TimeoutException {
+       public void taskSend(String mailbox, Task task, double timeout) throws TransferFailureException, HostFailureException, TimeoutException {
                MsgNative.taskSend(mailbox, task, timeout);
        }
 
                MsgNative.taskSend(mailbox, task, timeout);
        }
 
@@ -365,27 +359,27 @@ public abstract class Process extends Thread {
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException */
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException */
-       public void taskSend(String mailbox, Task task) throws NativeException, TransferFailureException, HostFailureException, TimeoutException {
+       public void taskSend(String mailbox, Task task) throws  TransferFailureException, HostFailureException, TimeoutException {
                MsgNative.taskSend(mailbox, task, -1);
        }
 
        /** Receive a task on mailbox associated with the specified mailbox */
                MsgNative.taskSend(mailbox, task, -1);
        }
 
        /** Receive a task on mailbox associated with the specified mailbox */
-       public Task taskReceive(String mailbox) throws NativeException {
+       public Task taskReceive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, -1.0, null);
        }
 
        /** Receive a task on mailbox associated with the specified alias (waiting at most given time) */
                return MsgNative.taskReceive(mailbox, -1.0, null);
        }
 
        /** Receive a task on mailbox associated with the specified alias (waiting at most given time) */
-       public Task taskReceive(String mailbox, double timeout) throws NativeException {
+       public Task taskReceive(String mailbox, double timeout) throws  TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, timeout, null);
        }
 
        /** Receive a task on mailbox associated with the specified alias from given sender */
                return MsgNative.taskReceive(mailbox, timeout, null);
        }
 
        /** Receive a task on mailbox associated with the specified alias from given sender */
-       public Task taskReceive(String mailbox, double timeout, Host host) throws NativeException {
+       public Task taskReceive(String mailbox, double timeout, Host host) throws  TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, timeout, host);
        }
 
        /** Receive a task on mailbox associated with the specified alias from given sender*/
                return MsgNative.taskReceive(mailbox, timeout, host);
        }
 
        /** Receive a task on mailbox associated with the specified alias from given sender*/
-       public Task taskReceive(String mailbox, Host host) throws NativeException {
+       public Task taskReceive(String mailbox, Host host) throws  TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, -1.0, host);
        }
 }
                return MsgNative.taskReceive(mailbox, -1.0, host);
        }
 }
index 3c54be4..bc2cdaa 100644 (file)
@@ -73,7 +73,7 @@ public class Task {
                return MsgNative.taskGetSender(this);
        }
        /** Gets the source of the task */ 
                return MsgNative.taskGetSender(this);
        }
        /** Gets the source of the task */ 
-       public Host getSource() throws NativeException {
+       public Host getSource()  {
                return MsgNative.taskGetSource(this);
        }
        /** Gets the computing amount of the task */ 
                return MsgNative.taskGetSource(this);
        }
        /** Gets the computing amount of the task */ 
@@ -106,9 +106,9 @@ public class Task {
        /**
         * Executes a task on the location on which the process is running.
         *
        /**
         * Executes a task on the location on which the process is running.
         *
-        * @exception NativeException if the execution failed.
+        * @exception HostFailureException,TaskCancelledException 
         */ 
         */ 
-       public void execute() throws NativeException {
+       public void execute() throws HostFailureException,TaskCancelledException {
                MsgNative.taskExecute(this);
        }
        /**
                MsgNative.taskExecute(this);
        }
        /**
@@ -116,7 +116,7 @@ public class Task {
         *
         * @exception NativeException if the cancellation failed.
         */ 
         *
         * @exception NativeException if the cancellation failed.
         */ 
-       public void cancel() throws NativeException {
+       public void cancel()  {
                MsgNative.taskCancel(this);
        }
        /** Deletes a task.
                MsgNative.taskCancel(this);
        }
        /** Deletes a task.
@@ -131,12 +131,11 @@ public class Task {
        /**
         * Sends the task on the mailbox identified by the specified name 
         *
        /**
         * Sends the task on the mailbox identified by the specified name 
         *
-        * @exception  NativeException if the retrieval fails.
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
-       public void send(String mailbox) throws NativeException, TransferFailureException, HostFailureException, TimeoutException {
+       public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
                MsgNative.taskSend(mailbox, this, -1);
        } 
 
                MsgNative.taskSend(mailbox, this, -1);
        } 
 
@@ -155,73 +154,70 @@ public class Task {
        /**
         * Sends the task on the mailbox identified by the specified alias  (capping the sending rate to \a maxrate) 
         *
        /**
         * Sends the task on the mailbox identified by the specified alias  (capping the sending rate to \a maxrate) 
         *
-        * @exception  NativeException if the retrieval fails.
+        * @exception  TransferFailureException, HostFailureException, TimeoutException.
         */
         */
-       public void sendBounded(String alias, double maxrate) throws NativeException {
+       public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
                MsgNative.taskSendBounded(alias, this, maxrate);
        } 
 
        /**
         * Retrieves next task from the mailbox identified by the specified name
         *
                MsgNative.taskSendBounded(alias, this, maxrate);
        } 
 
        /**
         * Retrieves next task from the mailbox identified by the specified name
         *
-        * @exception  NativeException if the retrieval fails.
+        * @exception  TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
         */
 
         */
 
-       public static Task receive(String mailbox) throws NativeException {
+       public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, -1.0, null);
        }
 
        /**
         * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
         *
                return MsgNative.taskReceive(mailbox, -1.0, null);
        }
 
        /**
         * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
         *
-        * @exception  NativeException if the retrieval fails.
+        * @exception  TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
         */
         */
-       public static Task receive(String mailbox, double timeout) throws  NativeException {
+       public static Task receive(String mailbox, double timeout) throws  TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, timeout, null);
        }
 
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias 
         *
                return MsgNative.taskReceive(mailbox, timeout, null);
        }
 
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias 
         *
-        * @exception  NativeException if the retrieval fails.
+        * @exception  TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
         */
 
         */
 
-       public static Task receive(String mailbox, Host host) throws NativeException {
+       public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, -1.0, host);
        }
 
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
         *
                return MsgNative.taskReceive(mailbox, -1.0, host);
        }
 
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
         *
-        * @exception  NativeException if the retrieval fails.
+        * @exception  TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
         */
         */
-       public static Task receive(String mailbox, double timeout, Host host) throws NativeException {
+       public static Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
                return MsgNative.taskReceive(mailbox, timeout, host);
        }
 
        /**
         * Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it
         *
                return MsgNative.taskReceive(mailbox, timeout, host);
        }
 
        /**
         * Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it
         *
-        * @exception  NativeException if the retrieval fails.
         */ 
         */ 
-       public static int listenFrom(String mailbox) throws NativeException  {
+       public static int listenFrom(String mailbox)  {
                return MsgNative.taskListenFrom(mailbox);
        }
        /**
         * Listen whether there is a waiting task on the mailbox identified by the specified alias
         *
                return MsgNative.taskListenFrom(mailbox);
        }
        /**
         * Listen whether there is a waiting task on the mailbox identified by the specified alias
         *
-        * @exception  NativeException if the retrieval fails.
         */ 
         */ 
-       public static boolean listen(String mailbox) throws NativeException  {
+       public static boolean listen(String mailbox)   {
                return MsgNative.taskListen(mailbox);
        }
 
        /**
         * Counts the number of tasks waiting to be received on the \a mailbox identified by the specified alia and sended by the specified \a host.
         *
                return MsgNative.taskListen(mailbox);
        }
 
        /**
         * Counts the number of tasks waiting to be received on the \a mailbox identified by the specified alia and sended by the specified \a host.
         *
-        * @exception  NativeException if the retrieval fails.
         */ 
         */ 
-       public static int listenFromHost(String alias, Host host) throws NativeException  {
+       public static int listenFromHost(String alias, Host host)   {
                return MsgNative.taskListenFromHost(alias, host);
        }
 }
                return MsgNative.taskListenFromHost(alias, host);
        }
 }