Class ParallelTasks<C extends FlowContext>
- java.lang.Object
-
- org.jboss.elemento.flow.ParallelTasks<C>
-
- Type Parameters:
C- the type of the context shared between tasks
- All Implemented Interfaces:
Task<C>
public class ParallelTasks<C extends FlowContext> extends Object implements Task<C>
A task implementation that executes a list of asynchronous tasks in parallel.This implementation makes it easy to nest the execution of asynchronous tasks inside a call to
Flow.parallel(FlowContext, List),Flow.sequential(FlowContext, List)orFlow.repeat(FlowContext, Task).
-
-
Constructor Summary
Constructors Constructor Description ParallelTasks(C context, List<Task<C>> tasks)Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.ParallelTasks(C context, List<Task<C>> tasks, boolean failFast)Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.ParallelTasks(C context, List<Task<C>> tasks, boolean failFast, long timeout)Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.ParallelTasks(List<Task<C>> tasks)Creates a new task that executes the given list of asynchronous tasks in parallel re-using an existing context.ParallelTasks(List<Task<C>> tasks, boolean failFast)Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.ParallelTasks(List<Task<C>> tasks, boolean failFast, long timeout)Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.
-
-
-
Constructor Detail
-
ParallelTasks
public ParallelTasks(List<Task<C>> tasks)
Creates a new task that executes the given list of asynchronous tasks in parallel re-using an existing context.The task fails fast and re-uses the context from the outer call to
Flow.parallel(FlowContext, List),Flow.sequential(FlowContext, List)orFlow.repeat(FlowContext, Task).- Parameters:
tasks- the list of tasks to execute
-
ParallelTasks
public ParallelTasks(List<Task<C>> tasks, boolean failFast)
Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.The task re-uses the context from the outer call to
Flow.parallel(FlowContext, List),Flow.sequential(FlowContext, List)orFlow.repeat(FlowContext, Task).- Parameters:
tasks- The list of tasks to executefailFast- whether the execution of the tasks should fail fast or fail last
-
ParallelTasks
public ParallelTasks(List<Task<C>> tasks, boolean failFast, long timeout)
Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.The task re-uses the context from the outer call to
Flow.parallel(FlowContext, List),Flow.sequential(FlowContext, List)orFlow.repeat(FlowContext, Task).- Parameters:
tasks- The list of tasks to executefailFast- whether the execution of the tasks should fail fast or fail lasttimeout- the timeout in milliseconds for the sequence
-
ParallelTasks
public ParallelTasks(C context, List<Task<C>> tasks)
Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.The task fails fast and uses the given context for the execution of the asynchronous tasks.
- Parameters:
context- the context shared between taskstasks- The list of tasks to execute
-
ParallelTasks
public ParallelTasks(C context, List<Task<C>> tasks, boolean failFast)
Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.The task uses the given context for the execution of the asynchronous tasks.
- Parameters:
context- the context shared between taskstasks- The list of tasks to executefailFast- whether the execution of the tasks should fail fast or fail last
-
ParallelTasks
public ParallelTasks(C context, List<Task<C>> tasks, boolean failFast, long timeout)
Creates a new task that executes the given list of asynchronous tasks in parallel using a new context.The task uses the given context for the execution of the asynchronous tasks.
- Parameters:
context- the context shared between taskstasks- The list of tasks to executefailFast- whether the execution of the tasks should fail fast or fail lasttimeout- the timeout in milliseconds for the sequence
-
-