Interface TaskContext

  • All Superinterfaces:
    TaskRef

    public interface TaskContext
    extends TaskRef
    Internal context that binds a Task to an execution Stage. A TaskContext is used by a Task to re-cue itself for execution, to spawn child tasks, and to set timers. TaskContext is thread safe.
    See Also:
    Task
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean cancel()
      Cancels the task to prevent it from executing.
      boolean cue()
      Schedules the task to execute as a sequential process.
      boolean isCued()
      Returns true if the task is currently scheduled for execution.
      Stage stage()
      Returns the execution Stage to which the task is bound.
    • Method Detail

      • stage

        Stage stage()
        Returns the execution Stage to which the task is bound.
      • isCued

        boolean isCued()
        Returns true if the task is currently scheduled for execution.
        Specified by:
        isCued in interface TaskRef
      • cue

        boolean cue()
        Schedules the task to execute as a sequential process. Returns true if this operation caused the scheduling of the task; returns false if the task was already scheduled to execute. Task.runTask() will be concurrently invoked exactly once for each time cue() returns true, minus the number of times cancel() returns true. The task becomes uncued prior to the the invocation of runTask(), enabling the task to re-cue itself while running.
        Specified by:
        cue in interface TaskRef
      • cancel

        boolean cancel()
        Cancels the task to prevent it from executing. Returns true if this operation caused the cancellation of the task; returns false if the task was not scheduled to execute.
        Specified by:
        cancel in interface TaskRef