Interface Task<T>
- Type Parameters:
T
- the type of result produced by theTask
- All Superinterfaces:
ExternalizableLite
,Serializable
Executor
s, may generate intermediate results, and may yield for
later execution.
Implementations define a single method called execute(Context)
that performs the task, possibly yielding execution to some later point.
Once the method has completed execution, by returning a result or throwing
an exception (but not a Yield exception), the task is considered completed
for the assigned Executor
.
Task
s are like Callable
and Runnable
classes in
that they are designed to be potentially executed by one or more
Thread
s, typically Executor
s. Unlike Callable
and
Runnable
classes, the execution may occur in Java Virtual Machines,
fail and/or recover between different Java Virtual Machine processes.
As such, it is recommended to account for fail-over if a task is recovered.
Important execution state should be saved in the in the Task.Context
properties
. Tasks should check
Task.Context.isResuming()
to determine if the task has failed over to
another executor and if execution state should be recovered from the
Task.Context
properties
.
- Since:
- 21.12
- Author:
- bo
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Provides the mechanism to submit, orchestrate and collect results from aTask
defined as part of anTask.Orchestration
, including the creation of aTask.Coordinator
to subscribe to results, manage and interact with an orchestratedTask
.static interface
A mutable reduction operation that accumulates results into a mutable result container, optionally transforming the accumulated result into a final representation after all results have been processed.static interface
ATask.Collectable
that supports performing operations when aTask
orchestration is complete.static interface
A runnable to be called upon task completion.static interface
static interface
static interface
An option for configuringTask
orchestration.static interface
static interface
Define an interface to allow states sharing between the task executors.static interface
Defines the subset ofTask.Orchestration
methods which are permitted afterTask.SubscribedOrchestration.subscribe(Subscriber)
is called.static interface
A receiver of items produced by aTask.Coordinator
.static interface
Represents a subscription aTask.Subscriber
has made to aTask.Coordinator
, allowing control and termination of theTask.Subscription
.static class
-
Method Summary
Methods inherited from interface com.tangosol.io.ExternalizableLite
readExternal, writeExternal
-
Method Details
-
execute
Executes theTask
.- Parameters:
context
- theTask.Context
- Returns:
- the result of executing the
Task
- Throws:
Task.Yield
- which indicates theTask
execution should yield execution until some later point in timeException
-