Interface Task

All Known Subinterfaces:
BlockingTask
All Known Implementing Classes:
BackgroundTask, ForegroundTask

public interface Task
A task defines a piece of code that may be executed - in the foreground or background - within a certain budget that is specific to the task type.
  • Method Details

    • getName

      String getName()
      Optional name of the task
    • getStatus

      Task.Status getStatus()
      Gets the task status.
    • elapsed

      Duration elapsed()
      How long it took to run the task when the task was completed
      Returns:
      The duration to execute the task
    • iteration

      int iteration()
      The current number of iterations (such as when the task is being repeated)
      Returns:
      the current number of iterations
    • getCurrentDelay

      long getCurrentDelay()
      The current computed delay.
    • getCurrentElapsedTime

      long getCurrentElapsedTime()
      The current elapsed time.
    • getFirstAttemptTime

      long getFirstAttemptTime()
      The time the first attempt was performed.
    • getLastAttemptTime

      long getLastAttemptTime()
      The time the last attempt has been performed.
    • getNextAttemptTime

      long getNextAttemptTime()
      An indication about the time the next attempt will be made.
    • getException

      Throwable getException()
      The task failed for some un-expected exception