Interface TaskExecutor<T,V>


public interface TaskExecutor<T,V>
  • Method Details

    • startExecution

      void startExecution()
      Executes background task.
    • cancelExecution

      boolean cancelExecution()
      Cancels the execution and removes task form BackgroundTaskWatchDog and from BackgroundTaskManager.
      Returns:
      true if the canceling was successful
    • getResult

      @Nullable V getResult()
      Joins task thread to current and waits if task is not finished.
      Returns:
      result of the task
    • getTask

      BackgroundTask<T,V> getTask()
      Returns:
      the task
    • isCancelled

      boolean isCancelled()
    • isDone

      boolean isDone()
    • inProgress

      boolean inProgress()
    • setFinalizer

      void setFinalizer(Runnable finalizer)
      Sets done handler for clear resources.
      Parameters:
      finalizer - Runnable handler
    • getFinalizer

      Runnable getFinalizer()
    • handleProgress

      void handleProgress(T... changes)
      Handles changes from working thread.
      Parameters:
      changes - Changes