com.isti.util.queue
Class NotifyThread

java.lang.Object
  extended by com.isti.util.queue.NotifyThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
NotifyEventQueue

public abstract class NotifyThread
extends java.lang.Object
implements java.lang.Runnable

Class NotifyThread defines a thread with notify-support methods. Original author: Shawn Boyce.


Field Summary
protected  java.lang.Object m_stateLock
           
 
Constructor Summary
NotifyThread(java.lang.String id)
          Creates a thread with notify-support methods.
 
Method Summary
 void finishWorkAndStopThread()
          Finish pending work and stop the thread
 boolean isRunning()
          Determines if this thread has been stopped.
 void resumeThread()
          Resumes the thread.
 void setDaemonThread(boolean flgVal)
          Marks this thread as either a daemon thread or a user thread.
protected  void setRunning(boolean value)
          Sets the running status of the thread.
protected  boolean shouldFinishWork()
          Determines if 'finishWorkAndStopThread()' has been called.
 void startThread()
          Starts the thread.
 void stopThread()
          Stops the thread.
 void suspendThread()
          Suspends the thread.
 java.lang.String toString()
          Returns the thread name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

m_stateLock

protected final java.lang.Object m_stateLock
Constructor Detail

NotifyThread

public NotifyThread(java.lang.String id)
Creates a thread with notify-support methods.

Parameters:
id - name of thread.
Method Detail

isRunning

public boolean isRunning()
Determines if this thread has been stopped.

Returns:
false if 'stopThread()' has been called; true if not.

setDaemonThread

public void setDaemonThread(boolean flgVal)
Marks this thread as either a daemon thread or a user thread. The Java Virtual Machine exits when the only threads running are all daemon threads. This method must be called before the thread is started (via the 'startThread()' method).

Parameters:
flgVal - true for a daemon thread; false for user thread.

setRunning

protected void setRunning(boolean value)
Sets the running status of the thread.

Parameters:
value - true for running; false for stopped.

shouldFinishWork

protected boolean shouldFinishWork()
Determines if 'finishWorkAndStopThread()' has been called.

Returns:
true if 'finishWorkAndStopThread()' has been called; false if not.

startThread

public void startThread()
Starts the thread.


resumeThread

public void resumeThread()
Resumes the thread.


suspendThread

public void suspendThread()
Suspends the thread.


stopThread

public void stopThread()
Stops the thread.


finishWorkAndStopThread

public void finishWorkAndStopThread()
Finish pending work and stop the thread


toString

public final java.lang.String toString()
Returns the thread name.

Overrides:
toString in class java.lang.Object
Returns:
The thread name.