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 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.
-
-
-
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.InterruptedException
Description copied from interface:Task
Wait until the task is finished, but only a given time.- Specified by:
waitFinished
in 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:Task
Wait until the task is finished.- Specified by:
waitFinished
in interfaceTask
-
isFinished
public boolean isFinished()
Description copied from interface:Task
Test whether the task has finished running.- Specified by:
isFinished
in interfaceTask
- Returns:
-
-