|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.runtime.TaskID<E> pt.runtime.TaskIDGroup<E>
E
- public class TaskIDGroup<E>
An extension of TaskID
to contain multiple tasks. In particular, a TaskIDGroup
is returned for
all multi-task invocations. Users may also instantiate a TaskIDGroup
and populate it with multiple
TaskID
s (and TaskIDGroup
s). This would be useful, for example, when invoking many different
tasks, allowing a collective approach to synchronise on those tasks (i.e. wait on the TaskIDGroup
rather
than the on each individual TaskID
.
Field Summary |
---|
Fields inherited from class pt.runtime.TaskID |
---|
cancelled, CANCELLED, cancelRequested, CREATED, enclosingTask, globalID, group, hasCompleted, hasSlots, hasUserError, nextGlobalID, relativeID, STARTED, status, taskInfo |
Constructor Summary | |
---|---|
TaskIDGroup(int groupSize)
This public constructor is actually used to group a bunch of tasks, which may include one-off task or multi task, should not give any id to this group. |
Method Summary | |
---|---|
void |
add(TaskID<E> id)
|
boolean |
cancelAttempt()
Canceling a group is currently not supported. |
java.lang.Throwable |
getException()
Returns the exception that occurred while this task executed. |
protected boolean |
getExpanded()
|
E |
getInnerTaskResult(int relativeID)
Returns the result of a particular task. |
E |
getReturnResult()
Get the result of a group of tasks. |
E |
getReturnResult(Reduction<E> red)
Perform a reduction on the results contained in the group. |
java.util.Iterator<TaskID<E>> |
groupMembers()
Return an iterator for the set of TaskID s contained in this group. |
int |
groupSize()
Returns the group size. |
boolean |
hasCompleted()
Checks to see whether all the inner tasks have completed. |
boolean |
hasUserError()
Checks to see whether any of the inner tasks contained an error. |
boolean |
isMultiTask()
Checks whether this TaskIDGroup represents a multi-task. |
E |
reduce(Reduction<E> red)
Perform a reduction on the set of results. |
protected void |
setExpanded(boolean isExpanded)
|
void |
waitTillFinished()
Waits for all the contained inner tasks to complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TaskIDGroup(int groupSize)
Method Detail |
---|
public boolean isMultiTask()
TaskIDGroup
to group a set of TaskID
s, but those TaskID
s might not necessarily
be part of a multi-task.
isMultiTask
in class TaskID<E>
true
if this TaskIDGroup
represents an actual multi-task, false
otherwisepublic void add(TaskID<E> id)
public int groupSize()
public E reduce(Reduction<E> red) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
red
- The reduction to perform
TaskID
s contained in this group.
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public E getInnerTaskResult(int relativeID) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
relativeID
- The relative ID of the task whose result is wanted.
java.util.concurrent.ExecutionException
java.lang.InterruptedException
CurrentTask.relativeID()
,
TaskID.relativeID()
public java.util.Iterator<TaskID<E>> groupMembers()
TaskID
s contained in this group.
public java.lang.Throwable getException()
TaskID
getException
in class TaskID<E>
public E getReturnResult() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
TaskIDGroup
. To get the results,
must either perform a reduction or get results of the individual tasks.
getReturnResult
in class TaskID<E>
java.lang.UnsupportedOperationException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
getReturnResult(Reduction)
,
getInnerTaskResult(int)
public E getReturnResult(Reduction<E> red) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
red
- The reduction to perform on the results of the contained TaskIDs
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public boolean hasCompleted()
hasCompleted
in class TaskID<E>
true
if it has completed, false
otherwiseTaskID.getProgress()
,
CurrentTask.getProgress()
public boolean hasUserError()
hasUserError
in class TaskID<E>
true
if there was an error, false
otherwisepublic boolean cancelAttempt()
cancelAttempt
in class TaskID<E>
true
if it has cancelled successfully, false
otherwise.
java.lang.UnsupportedOperationException
TaskID.cancelRequested()
,
CurrentTask.cancelRequested()
,
TaskID.cancelledSuccessfully()
public void waitTillFinished() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
waitTillFinished
in class TaskID<E>
java.util.concurrent.ExecutionException
java.lang.InterruptedException
protected void setExpanded(boolean isExpanded)
protected boolean getExpanded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |