Class BackgroundRunner.BackgroundTask

  • All Implemented Interfaces:
    Task
    Enclosing class:
    BackgroundRunner

    public static class BackgroundRunner.BackgroundTask
    extends java.lang.Object
    implements Task
    Implementation of Task backed by ExecutorService provided by BackgroundTask or its descendant classes.
    • Method Summary

      All Methods Instance Methods Concrete 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 i)
      Wait until the task is finished, but only a given time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • schedule

        public final void schedule​(int delay)
        Description copied from interface: Task
        (Re-)schedules a task to run in the future.
        Specified by:
        schedule in interface Task
      • waitFinished

        public boolean waitFinished​(long i)
                             throws java.lang.InterruptedException
        Description copied from interface: Task
        Wait until the task is finished, but only a given time.
        Specified by:
        waitFinished in interface Task
        Parameters:
        i - 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

        public void waitFinished()
        Description copied from interface: Task
        Wait until the task is finished.
        Specified by:
        waitFinished in interface Task
      • isFinished

        public boolean isFinished()
        Description copied from interface: Task
        Test whether the task has finished running.
        Specified by:
        isFinished in interface Task
        Returns:
      • thenRun

        public void thenRun​(java.lang.Runnable nextTask)
        Specified by:
        thenRun in interface Task
      • cancel

        public void cancel()
        Description copied from interface: Task
        Removes the task from the queue.
        Specified by:
        cancel in interface Task