|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.util.JobQueue
public class JobQueue
The job queue is meant for threads that are executed very often and do the same things, e.g. updating the screen with different values. At all times, only one job in the queue is executed, and the queue allows no more than two jobs in total (one running and one waiting). If more than two jobs are added, any job in the queue that is currently not running is removed and the new job is added. It will then be executed right after the running job has finished, or it is removed if another job is added meanwhile.
Nested Class Summary | |
---|---|
static class |
JobQueue.Job
A job that may be added to the job queue. |
Field Summary | |
---|---|
private boolean |
m_bInterrupted
|
private JobQueue.Job |
m_currentJob
|
private java.lang.Thread |
m_currentJobThread
|
private java.util.Vector |
m_jobs
|
private java.util.Vector |
m_jobThreads
|
private java.lang.Thread |
m_threadQueue
|
Constructor Summary | |
---|---|
JobQueue()
Creates and starts the job queue. |
|
JobQueue(java.lang.String a_name)
Creates and starts the job queue. |
Method Summary | |
---|---|
void |
addJob(JobQueue.Job a_anonJob)
Adds a new job to the queue that is run as soon as there are no other running threads left in the queue. |
private void |
removeJob(JobQueue.Job a_anonJob)
Must (!!) be called at the end of a job thread to remove this job from the queue and to tell the queue that the job was removed, so that a new job may be started. |
void |
stop()
Stops the queue once and for all and interupts all running threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Vector m_jobs
private java.util.Vector m_jobThreads
private java.lang.Thread m_threadQueue
private boolean m_bInterrupted
private JobQueue.Job m_currentJob
private java.lang.Thread m_currentJobThread
Constructor Detail |
---|
public JobQueue()
public JobQueue(java.lang.String a_name)
a_name
- name of the queueMethod Detail |
---|
public void addJob(JobQueue.Job a_anonJob)
a_anonJob
- a Jobpublic void stop()
private void removeJob(JobQueue.Job a_anonJob)
a_anonJob
- a Job to be removed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |