Interface Task

  • All Known Implementing Classes:
    BackgroundRunner.BackgroundTask

    public interface Task
    This interface allows control of tasks produced by BackgroundRunner.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void cancel()
      Removes the task from the queue.
      boolean isFinished()
      Test whether the task has finished running.
      void schedule​(int delay)
      (Re-)schedules a task to run in the future.
      void thenRun​(java.lang.Runnable nextTask)  
      void waitFinished()
      Wait until the task is finished.
      boolean waitFinished​(long milliseconds)
      Wait until the task is finished, but only a given time.
    • Method Detail

      • schedule

        void schedule​(int delay)
        (Re-)schedules a task to run in the future.
        Parameters:
        delay -
      • waitFinished

        boolean waitFinished​(long milliseconds)
                      throws java.lang.InterruptedException
        Wait until the task is finished, but only a given time.
        Parameters:
        milliseconds - thime to wait in milliseconds
        Returns:
        true if the task is really finished, or false if the time out has been exceeded
        Throws:
        java.lang.InterruptedException
      • waitFinished

        void waitFinished()
        Wait until the task is finished.
      • isFinished

        boolean isFinished()
        Test whether the task has finished running.
        Returns:
      • thenRun

        void thenRun​(java.lang.Runnable nextTask)
        Parameters:
        nextTask -
      • cancel

        void cancel()
        Removes the task from the queue.