Interface Task<T>
- Type Parameters:
T- the type of result produced by theTask
- All Superinterfaces:
ExternalizableLite,Serializable
Executors, 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.
Tasks are like Callable and Runnable classes in
that they are designed to be potentially executed by one or more
Threads, typically Executors. 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 interfaceProvides the mechanism to submit, orchestrate and collect results from aTaskdefined as part of anTask.Orchestration, including the creation of aTask.Coordinatorto subscribe to results, manage and interact with an orchestratedTask.static interfaceA 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 interfaceATask.Collectablethat supports performing operations when aTaskorchestration is complete.static interfaceA runnable to be called upon task completion.static interfacestatic interfacestatic interfaceAn option for configuringTaskorchestration.static interfacestatic interfaceDefine an interface to allow states sharing between the task executors.static interfaceDefines the subset ofTask.Orchestrationmethods which are permitted afterTask.SubscribedOrchestration.subscribe(Subscriber)is called.static interfaceA receiver of items produced by aTask.Coordinator.static interfaceRepresents a subscription aTask.Subscriberhas 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 theTaskexecution should yield execution until some later point in timeException
-