|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--de.qfs.lib.util.TaskQueue
A TaskQueue is a Thread that executes runnables from a queue.
It is used to handle related tasks, one after the other, from a single
background thread. New tasks can be added with addTask
and the thread can be terminated with the finish
method.
Inner Class Summary | |
static class |
TaskQueue.UnitTest
Test cases for the TaskQueue class. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
TaskQueue()
Create a new TaskQueue. |
|
TaskQueue(java.lang.String name)
Create a new TaskQueue. |
Method Summary | |
void |
addTask(java.lang.Runnable task)
Add a task to the TaskQueue. |
void |
finish(boolean immediately)
Terminate the operation of the TaskQueue. |
void |
run()
Remove tasks from the queue one by one and execute them. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TaskQueue()
public TaskQueue(java.lang.String name)
name
- The thread name for the TaskQueue.Method Detail |
public void run()
run
in class java.lang.Thread
public void finish(boolean immediately)
immediately
- If true, terminate the TaskQueue as soon as
possible. Otherwise no more new tasks will be
accepted and the thread will be terminated
when all pending tasks have been executed.public void addTask(java.lang.Runnable task)
task
- The Runnable to add.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |