Interface BackgroundTaskHandler<V>

Type Parameters:
V - type of task's result
All Known Implementing Classes:
TaskHandlerImpl

public interface BackgroundTaskHandler<V>
Task handler for BackgroundTask.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Cancels task.
    void
    Executes the BackgroundTask.
    Waits for the task completion and return its result.
    boolean
     
    boolean
     
    boolean
     
  • Method Details

    • execute

      void execute()
      Executes the BackgroundTask.
      This method must be called only once for a handler instance.
    • cancel

      boolean cancel()
      Cancels task.
      Returns:
      true if canceled, false if the task was not started or is already stopped
    • getResult

      @Nullable V getResult()
      Waits for the task completion and return its result.
      Returns:
      task's result returned from BackgroundTask.run(TaskLifeCycle) method
    • isDone

      boolean isDone()
      Returns:
      true if the task is completed
    • isCancelled

      boolean isCancelled()
      Returns:
      true if the task has been canceled
    • isAlive

      boolean isAlive()
      Returns:
      true if the task is running