2 * simgrid.msg.Task.java 1.00 07/05/01
4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
7 * This program is free software; you can redistribute
8 * it and/or modify it under the terms of the license
9 *(GNU LGPL) which comes with this package.
17 * This attribute represents a bind between a java task object and
18 * a native task. Even if this attribute is public you must never
19 * access to it. It is set automaticatly during the build of the object.
24 /* Default constructor (disabled) */
25 protected ParallelTask() {};
28 * Construct an new parallel task with the specified processing amount and amount for each host
31 * @param name The name of the parallel task.
32 * @param hosts The list of hosts implied by the parallel task.
33 * @param computeDurations The total number of operations that have to be performed
35 * @param messageSizes An array of doubles
36 * @exception InvalidTaskNameException if the specified name is null.
37 * InvalidComputeDuration if the parameter computeDurations is null.
38 * InvalidMessageSize if the parameter messageSizes is null.
40 public ParallelTask(String name, Host[] hosts,double[] computeDurations, double[] messageSizes)
42 create(name,hosts,computeDurations,messageSizes);
46 * This method creates a parallel task (if not already created).
48 * @param name The name of the parallel task.
49 * @param hosts The list of hosts implied by the parallel task.
50 * @param computeDurations The total number of operations that have to be performed
52 * @param messageSizes An array of doubles
53 * @exception InvalidTaskNameException if the specified name is null.
54 * InvalidComputeDuration if the parameter computeDurations is null.
55 * InvalidMessageSize if the parameter messageSizes is null.
57 public void create(String name, Host[] hosts,double[] computeDurations, double[] messageSizes)
61 Msg.parallelTaskCreate(this,name,hosts,computeDurations,messageSizes);
65 * This method gets the sender of the parallel task.
67 * @return The sender of the parallel task.
69 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
70 * is invalid if it is not binded with a native parallel task.
73 Process getSender() throws JniException {
74 return Msg.parallelTaskGetSender(this);
78 * This method gets the source of the parallel task.
80 * @return The source of the task.
82 * @exception InvalidTaskException is the specified parallel task is not valid. A task
83 * is invalid if it is not binded with a native parallel task.
85 public Host getSource() throws JniException {
86 return Msg.parallelTaskGetSource(this);
90 * This method gets the name of a parallel task.
92 * @return The name of the parallel task.
94 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
95 * is invalid if it is not binded with a native parallel task.
97 public String getName() throws JniException {
98 return Msg.parallelTaskGetName(this);
102 * This method cancels a task.
104 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
105 * is invalid if it is not binded with a native parallel task.
106 * MsgException if the cancelation failed.
108 public void cancel() throws JniException, NativeException {
109 Msg.parallelTaskCancel(this);
113 * This method gets the computing amount of the parallel task.
115 * @return The computing amount of the parallel task.
117 * @exception InvalidTaskException is the specified task is not valid. A task
118 * is invalid if it is not binded with a native task.
120 public double getComputeDuration() throws JniException {
121 return Msg.parallelTaskGetComputeDuration(this);
125 * This method gets the remaining computation.
127 * @return The remaining duration.
129 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
130 * is invalid if it is not binded with a native parallel task.
132 public double getRemainingDuration() throws JniException {
133 return Msg.parallelTaskGetRemainingDuration(this);
137 * This method sets the priority of the computation of the parallel task.
138 * The priority doesn't affect the transfert rate. For example a
139 * priority of 2 will make the task receive two times more cpu than
142 * @param The new priority of the parallel task.
144 * @exception InvalidTaskException is the specified task is not valid. A task
145 * is invalid if it is not binded with a native task.
147 public void setPrirority(double priority) throws JniException {
148 Msg.parallelTaskSetPriority(this,priority);
152 * This method destroies a parallel task.
154 * @exception InvalidTaskException is the specified task is not valid. A parallel task
155 * is invalid if it is not binded with a native task.
156 * MsgException if the destruction failed.
158 public void destroy() throws JniException, NativeException {
159 Msg.parallelTaskDestroy(this);
163 * This method deletes a parallel task.
165 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
166 * is invalid if it is not binded with a native parallel task.
167 * MsgException if the destruction failed.
169 protected void finalize() throws JniException, NativeException {
171 Msg.parallelTaskDestroy(this);
175 * This method execute a task on the location on which the
176 * process is running.
178 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
179 * is invalid if it is not binded with a native parallel task.
180 * MsgException if the destruction failed.
182 public void execute() throws JniException, NativeException {
183 Msg.parallelTaskExecute(this);