*(GNU LGPL) which comes with this package.
*/
-package simgrid.msg;
+package org.simgrid.msg;
/**
* A task is either something to compute somewhere, or something to exchange between two hosts (or both).
/* * * *
* * Getters / Setters * *
* * * */
- /** Gets the name of a task */
+ /** Gets the name of a task
+ * @return
+ */
public String getName() {
return MsgNative.taskGetName(this);
}
Process getSender() {
return MsgNative.taskGetSender(this);
}
- /** Gets the source of the task */
+ /** Gets the source of the task
+ * @return
+ */
public Host getSource() {
return MsgNative.taskGetSource(this);
}
- /** Gets the computing amount of the task */
+ /** Gets the computing amount of the task
+ * @return
+ */
public double getComputeDuration() {
return MsgNative.taskGetComputeDuration(this);
}
- /** Gets the remaining computation of the task */
+ /** Gets the remaining computation of the task
+ * @return
+ */
public double getRemainingDuration() {
return MsgNative.taskGetRemainingDuration(this);
}
/**
* This method sets the priority of the computation of the task.
- * The priority doesn't affect the transfert rate. For example a
+ * The priority doesn't affect the transfer rate. For example a
* priority of 2 will make the task receive two times more cpu than
* the other ones.
*
/**
* Executes a task on the location on which the process is running.
*
- * @exception HostFailureException,TaskCancelledException
- */
+ *
+ * @throws HostFailureException
+ * @throws TaskCancelledException
+ */
public void execute() throws HostFailureException,TaskCancelledException {
MsgNative.taskExecute(this);
}
/**
* Cancels a task.
*
- * @exception NativeException if the cancellation failed.
*/
public void cancel() {
MsgNative.taskCancel(this);
MsgNative.taskDestroy(this);
}
+
+ /** Send the task asynchronously on the mailbox identified by the specified name,
+ * with no way to retrieve whether the communication succeeded or not
+ *
+ */
+ public void dsend(String mailbox) {
+ MsgNative.taskDSend(mailbox, this);
+ }
+
/**
* Sends the task on the mailbox identified by the specified name
*
- * @throws TimeoutException
+ * @param mailbox
+ * @throws TimeoutException
* @throws HostFailureException
* @throws TransferFailureException
*/
/**
* Sends the task on the mailbox identified by the specified name (wait at most \a timeout seconds)
*
- * @exception NativeException if the retrieval fails.
+ * @param mailbox
+ * @param timeout
+ * @exception NativeException if the retrieval fails.
* @throws TimeoutException
* @throws HostFailureException
* @throws TransferFailureException
/**
* Sends the task on the mailbox identified by the specified alias (capping the sending rate to \a maxrate)
*
- * @exception TransferFailureException, HostFailureException, TimeoutException.
+ * @param alias
+ * @param maxrate
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
MsgNative.taskSendBounded(alias, this, maxrate);
}
-
+ /**
+ * Sends the task on the mailbox asynchronously
+ */
+ public native Comm isend(String mailbox);
+
+ /**
+ * Starts listening for receiving a task from an asynchronous communication
+ * @param mailbox
+ * @return
+ */
+ public static native Comm irecv(String mailbox);
/**
* Retrieves next task from the mailbox identified by the specified name
*
- * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
+ * @param mailbox
+ * @return
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
/**
* Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
*
- * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
+ * @param mailbox
+ * @param timeout
+ * @return
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
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
*
- * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
+ * @param mailbox
+ * @param host
+ * @return
+ * @throws TransferFailureException
+ * @throws TimeoutException
+ * @throws HostFailureException
*/
public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
/**
* Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
*
- * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails.
+ * @param mailbox
+ * @param timeout
+ * @param host
+ * @return
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
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
*
- */
+ *
+ * @param mailbox
+ * @return
+ */
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
*
- */
+ *
+ * @param mailbox
+ * @return
+ */
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.
*
- */
+ *
+ * @param alias
+ * @param host
+ * @return
+ */
public static int listenFromHost(String alias, Host host) {
return MsgNative.taskListenFromHost(alias, host);
}