Package com.im.commons.progress
Class BackgroundRunner.BackgroundTask
- java.lang.Object
-
- com.im.commons.progress.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.
-
-
Constructor Summary
Constructors Constructor Description BackgroundTask(BackgroundRunner runner)BackgroundTask(BackgroundRunner runner, int delay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Removes the task from the queue.booleanisFinished()Test whether the task has finished running.voidschedule(int delay)(Re-)schedules a task to run in the future.voidthenRun(java.lang.Runnable nextTask)voidwaitFinished()Wait until the task is finished.booleanwaitFinished(long i)Wait until the task is finished, but only a given time.
-
-
-
Constructor Detail
-
BackgroundTask
public BackgroundTask(BackgroundRunner runner, int delay)
-
BackgroundTask
public BackgroundTask(BackgroundRunner runner)
-
-
Method Detail
-
schedule
public final void schedule(int delay)
Description copied from interface:Task(Re-)schedules a task to run in the future.
-
waitFinished
public boolean waitFinished(long i) throws java.lang.InterruptedExceptionDescription copied from interface:TaskWait until the task is finished, but only a given time.- Specified by:
waitFinishedin interfaceTask- 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:TaskWait until the task is finished.- Specified by:
waitFinishedin interfaceTask
-
isFinished
public boolean isFinished()
Description copied from interface:TaskTest whether the task has finished running.- Specified by:
isFinishedin interfaceTask- Returns:
-
-