Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
jtask: remove the ability to receive from a given host
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 21 Mar 2017 12:33:24 +0000 (13:33 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 21 Mar 2017 12:43:41 +0000 (13:43 +0100)
This is disabled in the underlying code since a long time

src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_task.h
src/bindings/java/org/simgrid/msg/Task.java

index 9c1ad74..f3df891 100644 (file)
@@ -274,23 +274,12 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobjec
     jmsg_throw_status(env, res);
 }
 
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass cls, jstring jalias, jdouble jtimeout,
-                                                            jobject jhost)
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass cls, jstring jalias, jdouble jtimeout)
 {
   msg_task_t task = nullptr;
-  msg_host_t host = nullptr;
-
-  if (jhost) {
-    host = jhost_get_native(env, jhost);
-
-    if (!host) {
-      jxbt_throw_notbound(env, "host", jhost);
-      return nullptr;
-    }
-  }
 
   const char *alias = env->GetStringUTFChars(jalias, 0);
-  msg_error_t rv = MSG_task_receive_ext(&task, alias, (double) jtimeout, host);
+  msg_error_t rv    = MSG_task_receive_ext(&task, alias, (double)jtimeout, /*host*/ nullptr);
   env->ReleaseStringUTFChars(jalias, alias);
   if (env->ExceptionOccurred())
     return nullptr;
@@ -305,7 +294,6 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass
   env->DeleteGlobalRef(jtask_global);
   MSG_task_set_data(task, nullptr);
 
-
   return (jobject) jtask_local;
 }
 
@@ -336,30 +324,19 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass c
   return jcomm;
 }
 
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv * env, jclass cls, jstring jalias,
-                                                                   jdouble jtimeout, jobject jhost, jdouble rate)
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv* env, jclass cls, jstring jalias,
+                                                                   jdouble jtimeout, jdouble rate)
 {
-  msg_error_t rv;
   msg_task_t *task = xbt_new(msg_task_t,1);
   *task = nullptr;
 
-  msg_host_t host = nullptr;
-
-  if (jhost) {
-    host = jhost_get_native(env, jhost);
-
-    if (!host) {
-      jxbt_throw_notbound(env, "host", jhost);
-      return nullptr;
-    }
-  }
-
   const char *alias = env->GetStringUTFChars(jalias, 0);
-  rv = MSG_task_receive_ext_bounded(task, alias, static_cast<double>(jtimeout), host, static_cast<double>(rate));
+  msg_error_t res   = MSG_task_receive_ext_bounded(task, alias, static_cast<double>(jtimeout), /*host*/ nullptr,
+                                                 static_cast<double>(rate));
   if (env->ExceptionOccurred())
     return nullptr;
-  if (rv != MSG_OK) {
-    jmsg_throw_status(env,rv);
+  if (res != MSG_OK) {
+    jmsg_throw_status(env, res);
     return nullptr;
   }
   jobject jtask_global = (jobject) MSG_task_get_data(*task);
index 5c44476..d25c41c 100644 (file)
@@ -44,11 +44,10 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount(JNIEnv* env, job
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv* env, jobject jtask, jstring jalias,
                                                              jdouble  jtimeout, jdouble maxrate);
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass cls, jstring jalias, jdouble jtimeout,
-                                                            jobject jhost);
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass cls, jstring jalias, jdouble jtimeout);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv* env, jclass cls, jstring jmailbox);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv* env, jclass cls, jstring jalias,
-                                                                   jdouble jtimeout, jobject jhost, jdouble rate);
+                                                                   jdouble jtimeout, jdouble rate);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv* env, jclass cls, jstring jmailbox,
                                                                  jdouble rate);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv* env, jobject jtask, jstring jmailbox);
index e66993d..0dec155 100644 (file)
@@ -271,49 +271,26 @@ public class Task {
         * @return a Comm handler
         */
        public static native Comm irecv(String mailbox);
-       /**
-        * Retrieves next task from the mailbox identified by the specified name
-        *
-        * @param mailbox
-        * @return a Task
-        */
-
-       public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
-               return receive(mailbox, -1.0, null);
-       }
 
        /**
-        * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
+        * Retrieves next task on the mailbox identified by the specified alias 
         *
         * @param mailbox
-        * @param timeout
-        * @return a Task
-        */
-       public static Task receive(String mailbox, double timeout) throws  TransferFailureException, HostFailureException, TimeoutException {
-               return receive(mailbox, timeout, null);
-       }
-
-       /**
-        * Retrieves next task sent by a given host on the mailbox identified by the specified alias 
-        *
-        * @param mailbox
-        * @param host
         * @return a Task
         */
 
-       public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
-               return receive(mailbox, -1.0, host);
+       public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
+               return receive(mailbox, -1.0);
        }
 
        /**
-        * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
+        * Retrieves next task on the mailbox identified by the specified alias (wait at most \a timeout seconds)
         *
         * @param mailbox
         * @param timeout 
-        * @param host
         * @return a Task
         */
-       public static native Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException;
+       public static native Task receive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
 
        /**
         * Starts listening for receiving a task from an asynchronous communication with a capped rate
@@ -329,7 +306,7 @@ public class Task {
         */
 
        public static Task receiveBounded(String mailbox, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
-               return receiveBounded(mailbox, -1.0, null, rate);
+               return receiveBounded(mailbox, -1.0, rate);
        }
 
        /**
@@ -339,32 +316,7 @@ public class Task {
         * @param timeout
         * @return a Task
         */
-       public static Task receiveBounded(String mailbox, double timeout, double rate) throws  TransferFailureException, HostFailureException, TimeoutException {
-               return receiveBounded(mailbox, timeout, null, rate);
-       }
-
-       /**
-        * Retrieves next task sent by a given host on the mailbox identified by the specified alias with a capped rate
-        *
-        * @param mailbox
-        * @param host
-        * @return a Task
-        */
-
-       public static Task receiveBounded(String mailbox, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
-               return receiveBounded(mailbox, -1.0, host, rate);
-       }
-
-       /**
-        * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
-        * with a capped rate
-        *
-        * @param mailbox
-        * @param timeout 
-        * @param host
-        * @return a Task
-        */
-       public static native Task receiveBounded(String mailbox, double timeout, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException;
+       public static native Task receiveBounded(String mailbox, double timeout, double rate) throws TransferFailureException, HostFailureException, TimeoutException;