TaskGroup<ResultT,TaskT> Class

Type Parameters

ResultT

type of the result returned by the tasks in the group

TaskT

type of the tasks in the group that can return a value

public class TaskGroup<ResultT,TaskT extends TaskItem> extends DAGraph<TaskT, TaskGroupEntry<ResultT, TaskT>>

Type representing a group of task entries, each entry holds a TaskItem and associated dependency information.

Constructor Summary

Constructor Description
TaskGroup(String rootTaskItemId, TaskT rootTaskItem, TaskGroupTerminateOnErrorStrategy taskGroupTerminateOnErrorStrategy)

Creates TaskGroup.

Method Summary

Modifier and Type Method and Description
Observable<ResultT> executeAsync()

Executes tasks in the group.

void merge(TaskGroup<ResultT, TaskT> parentTaskGroup)

Merge this group with the given group containing root task depends on this group.

ResultT taskResult(String taskId)

Gets the result produced by a task in the group.

Inherited Members

Constructor Details

TaskGroup

public TaskGroup(String rootTaskItemId, TaskT rootTaskItem, TaskGroupTerminateOnErrorStrategy taskGroupTerminateOnErrorStrategy)

Creates TaskGroup.

Parameters:

rootTaskItemId - the id of the root task in the group
rootTaskItem - the root task
taskGroupTerminateOnErrorStrategy - group termination strategy to be used on error

Method Details

executeAsync

public Observable executeAsync()

Executes tasks in the group.

Returns:

an observable that emits the result of tasks in the order they finishes.

merge

public void merge(TaskGroup parentTaskGroup)

Merge this group with the given group containing root task depends on this group.

Parameters:

parentTaskGroup - the parent task group

taskResult

public ResultT taskResult(String taskId)

Gets the result produced by a task in the group.

Parameters:

taskId - the task item id

Returns:

the task result, null will be returned if task has not yet been executed

Applies to