* with no way to retrieve whether the communication succeeded or not
*
*/
- public native void dsend(String mailbox);
+ public native void dsendBounded(String mailbox, double maxrate);
+
+
+ /** Send the task asynchronously on the mailbox identified by the specified name,
+ * with no way to retrieve whether the communication succeeded or not
+ *
+ */
+ public native void dsend(String mailbox);
+
/**
* Sends the task on the mailbox identified by the specified name
*
* @throws HostFailureException
* @throws TimeoutException
*/
- public native void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException;
+ public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
+ sendBounded(alias,-1,maxrate);
+ }
+
+
+/**
+ * Sends the task on the mailbox identified by the specified alias (capping the sending rate to \a maxrate) with a timeout
+ *
+ * @param alias
+ * @param timeout
+ * @param maxrate
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
+ */
+ public void sendBounded(String alias, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
+ sendBounded(alias,timeout,maxrate);
+ }
+
+
/**
* Sends the task on the mailbox asynchronously
*/
}
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env, jobject jtask,
- jstring jalias,
- jdouble jmaxRate)
+Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobject jtask,
+ jstring jalias,
+ jdouble jtimeout,
+ jdouble maxrate)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
msg_error_t rv;
- const char *alias;
+ const char *alias = (*env)->GetStringUTFChars(env, jalias, 0);
+
+ msg_task_t task = jtask_to_native_task(jtask, env);
+
if (!task) {
+ (*env)->ReleaseStringUTFChars(env, jalias, alias);
jxbt_throw_notbound(env, "task", jtask);
return;
}
- alias = (*env)->GetStringUTFChars(env, jalias, 0);
-
/* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) (*env)->NewGlobalRef(env, jtask));
-
xbt_ex_t e;
TRY {
- rv = MSG_task_send_bounded(task, alias, (double) jmaxRate);
+ rv = MSG_task_send_with_timeout_bounded(task, alias, (double) jtimeout, (double) maxrate);
}
CATCH(e) {
xbt_ex_free(e);
(*env)->ReleaseStringUTFChars(env, jalias, alias);
if (rv != MSG_OK) {
- jmsg_throw_status(env, rv);
+ jmsg_throw_status(env, rv);
}
}
-
JNIEXPORT jobject JNICALL
Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass cls,
jstring jalias, jdouble jtimeout,
(*env)->ReleaseStringUTFChars(env, jalias, alias);
}
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobject jtask,
+ jstring jalias, jdouble maxrate) {
+ const char *alias = (*env)->GetStringUTFChars(env, jalias, 0);
+
+ msg_task_t task = jtask_to_native_task(jtask, env);
+
+
+ if (!task) {
+ (*env)->ReleaseStringUTFChars(env, jalias, alias);
+ jxbt_throw_notbound(env, "task", jtask);
+ return;
+ }
+
+ /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
+ MSG_task_set_data(task, (void *) (*env)->NewGlobalRef(env, jtask));
+ MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend,(double)maxrate);
+
+ (*env)->ReleaseStringUTFChars(env, jalias, alias);
+}
+
+
+
JNIEXPORT jboolean JNICALL
Java_org_simgrid_msg_Task_listen(JNIEnv * env, jclass cls,
jstring jalias) {
Java_org_simgrid_msg_Task_send
(JNIEnv *, jobject, jstring, jdouble);
-/*
+/**
* Class org_simgrid_msg_Task
* Method sendBounded
*/
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_Task_sendBounded(JNIEnv *, jobject, jstring,
- jdouble);
+ Java_org_simgrid_msg_Task_sendBounded
+ (JNIEnv *, jobject, jstring, jdouble, jdouble);
+
/**
* Class org_simgrid_msg_Task
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jtask,
jstring jalias);
+
+/**
+ * Class org_simgrid_msg_Task
+ * Method dsendBounded
+ */
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobject jtask,
+ jstring jalias, jdouble maxrate);
+
/**
* Class org_simgrid_msg_Task
* Method listen