3 import org.simgrid.msg.HostFailureException;
4 import org.simgrid.msg.Task;
5 import org.simgrid.msg.TimeoutException;
6 import org.simgrid.msg.TransferFailureException;
9 * The PSGTask includes all the parameters of sending a message as the size, the
10 * compute duration and the protocol identifier.
12 * @author Khaled Baati 28/10/2014
13 * @version version 1.1
15 public class PSGTask extends org.simgrid.msg.Task {
16 /** The Message to be sent **/
18 /** The protocol identifier **/
22 * Construct a new task to be sent.
26 * @param computeDuration
27 * The compute duration
30 * The size of the message
32 * The message to be sent
34 * The protocol identifier
36 public PSGTask(String name, double computeDuration, double messageSize,
37 Object event, int pid) {
38 super(name, computeDuration, messageSize);
45 * @return the protocol identifier
55 public Object getEvent() {
60 * Retrieves next task on the mailbox identified by the specified name (wait
61 * at most timeout seconds)
64 * the mailbox on where to receive the task
66 * the timeout to wait for receiving the task
69 public static Task receive(String mailbox, double timeout) {
70 double time = PSGPlatform.getClock();
71 if (time + timeout > PSGPlatform.getClock()) {
73 return receive(mailbox, timeout, null);
74 } catch (TimeoutException e) {
75 } catch (TransferFailureException e) {
77 } catch (HostFailureException e) {