Task<V> Class
- java.
lang. Object - com.
microsoft. durabletask. Task<V>
- com.
Type Parameters
- V
the return type of the task
public abstract class Task<V>
Represents an asynchronous operation in a durable orchestration.
Task instances are created by methods on the TaskOrchestrationContext class, which is available in TaskOrchestration implementations. For example, scheduling an activity will return a task.
Task activityTask = ctx.callActivity("MyActivity", someInput, int.class);
Orchestrator code uses the await() method to block on the completion of the task and retrieve the result. If the task is not yet complete, the await() method will throw an OrchestratorBlockedException, which pauses the orchestrator's execution so that it can save its progress into durable storage and schedule any outstanding work. When the task is complete, the orchestrator will run again from the beginning and the next time the task's await() method is called, the result will be returned, or a TaskFailedException will be thrown if the result of the task was an unhandled exception.
Note that orchestrator code must never catch OrchestratorBlockedException because doing so can cause the orchestration instance to get permanently stuck.
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| abstract V |
await()
Blocks the orchestrator until this task to complete, and then returns its result. |
| boolean |
isCancelled()
Returns |
| boolean |
isDone()
Returns |
Methods inherited from java.lang.Object
Method Details
await
public abstract V await()
Blocks the orchestrator until this task to complete, and then returns its result.
Returns:
isCancelled
public boolean isCancelled()
Returns true if the task was cancelled.
Returns:
true if the task was cancelled, otherwise falseisDone
public boolean isDone()
Returns true if completed in any fashion: normally, with an exception, or via cancellation.
Returns:
true if completed, otherwise false