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;
env->DeleteGlobalRef(jtask_global);
MSG_task_set_data(task, nullptr);
-
return (jobject) jtask_local;
}
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);
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);
* @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
*/
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);
}
/**
* @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;