net.sf.fmj.ejmf.toolkit.media
Class ThreadQueue

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.fmj.ejmf.toolkit.media.ThreadQueue
All Implemented Interfaces:
java.lang.Runnable

public class ThreadQueue
extends java.lang.Thread

The ThreadQueue class provides a mechanism to run threads serially. When a thread is added, it will be started as soon as all threads added before it have completed. From the book: Essential JMF, Gordon, Talley (ISBN 0130801046). Used with permission.

Author:
Steve Talley & Rob Gordon

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadQueue(java.lang.String threadName)
          Constructs a ThreadQueue.
 
Method Summary
 void addThread(java.lang.Thread t)
          Add a thread to this ThreadQueue.
 void run()
          Monitor the thread queue.
 void stopThreads()
          Stop the currently running thread and any threads queued to run.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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

ThreadQueue

public ThreadQueue(java.lang.String threadName)
Constructs a ThreadQueue.

Method Detail

run

public void run()
Monitor the thread queue. When a thread is added, start it and block until it finishes.

This method is called when the thread is started. It should not be called directly.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

addThread

public void addThread(java.lang.Thread t)
Add a thread to this ThreadQueue.

Parameters:
t - The Thread to add.

stopThreads

public void stopThreads()
Stop the currently running thread and any threads queued to run. Remove all threads from the queue.