Interface Task.Context<T>
- Type Parameters:
T- the type of value produced by aTask
public static interface Task.Context<T>
-
Method Summary
Modifier and TypeMethodDescriptionObtain the unique identity of the executingExecutor.Obtain the properties of theTask.Obtains the unique identity of thisTask.booleanDetermines if aTaskwas cancelled.booleanisDone()Determines if aTaskcompleted according to theTaskExecutorService.booleanDetermines if aTaskexecution by anExecutorresuming after being recovered or due to resumption afterTask.Yielding.voidSets the intermediate result aTaskhas produced while being executed by anExecutoras part of anTask.Orchestration.
-
Method Details
-
setResult
Sets the intermediate result aTaskhas produced while being executed by anExecutoras part of anTask.Orchestration.The provided result may be later collected by an
TaskExecutorServiceaccording to the configuredTask.Collectorand then published to registeredTask.Subscribers.Multiple calls to this method are permitted during the execution of a
Task, thus permitting a stream of results to be collected and thus published.- Parameters:
result- the result
-
isDone
boolean isDone()Determines if aTaskcompleted according to theTaskExecutorService.Completion may be due to normal termination, an exception or cancellation. In all of these cases, this method will return
true.- Returns:
trueif theTaskis considered completedfalseotherwise
-
isCancelled
boolean isCancelled()Determines if aTaskwas cancelled.- Returns:
trueif the task was cancelled- Since:
- 22.06
-
isResuming
boolean isResuming()Determines if aTaskexecution by anExecutorresuming after being recovered or due to resumption afterTask.Yielding.- Returns:
trueif theTaskis
-
getProperties
Task.Properties getProperties()Obtain the properties of theTask.- Returns:
- the task properties
-
getTaskId
String getTaskId()Obtains the unique identity of thisTask.- Returns:
- the task identity
-
getExecutorId
String getExecutorId()Obtain the unique identity of the executingExecutor.- Returns:
- the executing
Executor's identity
-