Interface Task.Context<T>

  • Type Parameters:
    T - the type of value produced by a Task
    Enclosing interface:
    Task<T>

    public static interface Task.Context<T>
    Provides contextual information for a Task as it is executed, including the ability to access and update intermediate results for the Executor executing the said Task.
    • Method Detail

      • setResult

        void setResult​(T result)
        Sets the intermediate result a Task has produced while being executed by an Executor as part of an Task.Orchestration.

        The provided result may be later collected by an TaskExecutorService according to the configured Task.Collector and then published to registered Task.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 a Task completed according to the TaskExecutorService.

        Completion may be due to normal termination, an exception or cancellation. In all of these cases, this method will return true.

        Returns:
        true if the Task is considered completed false otherwise
      • isCancelled

        boolean isCancelled()
        Determines if a Task was cancelled.
        Returns:
        true if the task was cancelled
        Since:
        22.06
      • isResuming

        boolean isResuming()
        Determines if a Task execution by an Executor resuming after being recovered or due to resumption after Task.Yielding.
        Returns:
        true if the Task is
      • getProperties

        Task.Properties getProperties()
        Obtain the properties of the Task.
        Returns:
        the task properties
      • getTaskId

        String getTaskId()
        Obtains the unique identity of this Task.
        Returns:
        the task identity
      • getExecutorId

        String getExecutorId()
        Obtain the unique identity of the executing Executor.
        Returns:
        the executing Executor's identity