Package com.im.commons.progress
Interface Task
-
- All Known Implementing Classes:
BackgroundRunner.BackgroundTask
public interface TaskThis interface allows control of tasks produced by BackgroundRunner.
-
-
Method Summary
All Methods Instance Methods Abstract 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 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.InterruptedExceptionWait 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.
-
-