org.apache.pivot.util.concurrent
Class TaskGroup
java.lang.Object
org.apache.pivot.util.concurrent.Task<Void>
org.apache.pivot.util.concurrent.TaskGroup
- All Implemented Interfaces:
- Iterable<Task<?>>, Group<Task<?>>
public class TaskGroup
- extends Task<Void>
- implements Group<Task<?>>, Iterable<Task<?>>
Class that runs a group of tasks in parallel and notifies listeners
when all tasks are complete.
Fields inherited from class org.apache.pivot.util.concurrent.Task |
abort, timeout |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TaskGroup
public TaskGroup()
TaskGroup
public TaskGroup(Dispatcher dispatcher)
execute
public Void execute()
throws TaskExecutionException
- Description copied from class:
Task
- Synchronously executes the task.
- Specified by:
execute
in class Task<Void>
- Returns:
- The result of the task's execution.
- Throws:
TaskExecutionException
- If an error occurs while executing the task.
add
public boolean add(Task<?> element)
- Description copied from interface:
Group
- Adds an element to the group.
- Specified by:
add
in interface Group<Task<?>>
- Parameters:
element
- The element to add to the group.
- Returns:
- true if the element was added to the group; false,
otherwise.
remove
public boolean remove(Task<?> element)
- Description copied from interface:
Group
- Removes an element from the group.
- Specified by:
remove
in interface Group<Task<?>>
- Parameters:
element
- The element to remove from the set.
- Returns:
- true if the element was removed from the group; false,
otherwise.
contains
public boolean contains(Task<?> element)
- Description copied from interface:
Group
- Tests the existence of an element in the group.
- Specified by:
contains
in interface Group<Task<?>>
- Parameters:
element
- The element whose presence in the group is to be tested.
- Returns:
- true if the element exists in the group; false,
otherwise.
iterator
public Iterator<Task<?>> iterator()
- Specified by:
iterator
in interface Iterable<Task<?>>