javatools.thread
Class ThreadPoolThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--javatools.thread.ThreadPoolThread
All Implemented Interfaces:
java.lang.Runnable

public class ThreadPoolThread
extends java.lang.Thread

An internal class only for use with ThreadPool. It will notify the ThreadPool when it is done so that ThreadPool can get another piece of work going.


Field Summary
(package private)  boolean busy
           
(package private)  boolean keepGoing
           
(package private)  ThreadPool pool
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadPoolThread(ThreadPool pool, java.lang.ThreadGroup threadGroup, java.lang.String name)
          Create a thread belonging to a particular ThreadPool.
 
Method Summary
(package private)  boolean isBusy()
          Return whether this thread is currently busy.
 void run()
          Loop forever, waiting for work to do.
(package private)  void shutdown()
          Set the shutdown flag, and stop the thread the next time through the loop.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, 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
 

Field Detail

pool

ThreadPool pool

busy

boolean busy

keepGoing

boolean keepGoing
Constructor Detail

ThreadPoolThread

public ThreadPoolThread(ThreadPool pool,
                        java.lang.ThreadGroup threadGroup,
                        java.lang.String name)
Create a thread belonging to a particular ThreadPool.

Parameters:
pool - the Threadpool this thread belongs to
threadGroup - the ThreadGroup this thread belongs to
name - the name of this thread
Method Detail

run

public void run()
Loop forever, waiting for work to do.

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

isBusy

boolean isBusy()
Return whether this thread is currently busy. Of course in a threading environment, this condition can change at any time, so the result should only be considered indicative.

Returns:

shutdown

void shutdown()
Set the shutdown flag, and stop the thread the next time through the loop. This does not call pool.notify, so it's up to the caller to do that.