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() {
29 * Construct an new parallel task with the specified processing amount and amount for each host
32 * @param name The name of the parallel task.
33 * @param hosts The list of hosts implied by the parallel task.
34 * @param computeDurations The total number of operations that have to be performed
36 * @param messageSizes An array of doubles
37 * @exception InvalidTaskNameException if the specified name is null.
38 * InvalidComputeDuration if the parameter computeDurations is null.
39 * InvalidMessageSize if the parameter messageSizes is null.
41 public ParallelTask(String name, Host[]hosts, double[]computeDurations,
44 create(name, hosts, computeDurations, messageSizes);
47 * This method creates a parallel task (if not already created).
49 * @param name The name of the parallel task.
50 * @param hosts The list of hosts implied by the parallel task.
51 * @param computeDurations The total number of operations that have to be performed
53 * @param messageSizes An array of doubles
54 * @exception InvalidTaskNameException if the specified name is null.
55 * InvalidComputeDuration if the parameter computeDurations is null.
56 * InvalidMessageSize if the parameter messageSizes is null.
58 public void create(String name, Host[]hosts, double[]computeDurations,
63 Msg.parallelTaskCreate(this, name, hosts, computeDurations,
67 * This method gets the sender of the parallel task.
69 * @return The sender of the parallel task.
71 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
72 * is invalid if it is not binded with a native parallel task.
74 */ Process getSender() throws JniException {
75 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.
84 */ public Host getSource() throws JniException {
85 return Msg.parallelTaskGetSource(this);
88 * This method gets the name of a parallel task.
90 * @return The name of the parallel task.
92 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
93 * is invalid if it is not binded with a native parallel task.
94 */ public String getName() throws JniException {
95 return Msg.parallelTaskGetName(this);
98 * This method cancels a task.
100 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
101 * is invalid if it is not binded with a native parallel task.
102 * MsgException if the cancelation failed.
103 */ public void cancel() throws JniException, NativeException {
104 Msg.parallelTaskCancel(this);
107 * This method gets the computing amount of the parallel task.
109 * @return The computing amount of the parallel task.
111 * @exception InvalidTaskException is the specified task is not valid. A task
112 * is invalid if it is not binded with a native task.
113 */ public double getComputeDuration() throws JniException {
114 return Msg.parallelTaskGetComputeDuration(this);
117 * This method gets the remaining computation.
119 * @return The remaining duration.
121 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
122 * is invalid if it is not binded with a native parallel task.
123 */ public double getRemainingDuration() throws JniException {
124 return Msg.parallelTaskGetRemainingDuration(this);
127 * This method sets the priority of the computation of the parallel task.
128 * The priority doesn't affect the transfert rate. For example a
129 * priority of 2 will make the task receive two times more cpu than
132 * @param The new priority of the parallel task.
134 * @exception InvalidTaskException is the specified task is not valid. A task
135 * is invalid if it is not binded with a native task.
136 */ public void setPrirority(double priority) throws JniException {
137 Msg.parallelTaskSetPriority(this, priority);
140 * This method destroies a parallel task.
142 * @exception InvalidTaskException is the specified task is not valid. A parallel task
143 * is invalid if it is not binded with a native task.
144 * MsgException if the destruction failed.
145 */ public void destroy() throws JniException, NativeException {
146 Msg.parallelTaskDestroy(this);
149 * This method deletes a parallel task.
151 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
152 * is invalid if it is not binded with a native parallel task.
153 * MsgException if the destruction failed.
154 */ protected void finalize() throws JniException, NativeException {
156 Msg.parallelTaskDestroy(this);
159 * This method execute a task on the location on which the
160 * process is running.
162 * @exception InvalidTaskException is the specified parallel task is not valid. A parallel task
163 * is invalid if it is not binded with a native parallel task.
164 * MsgException if the destruction failed.
165 */ public void execute() throws JniException, NativeException {
166 Msg.parallelTaskExecute(this);