org.jasig.portal.utils
Class ThreadPoolWorker

java.lang.Object
  extended by java.lang.Thread
      extended by org.jasig.portal.utils.ThreadPoolWorker
All Implemented Interfaces:
java.lang.Runnable

public class ThreadPoolWorker
extends java.lang.Thread

An internal worker thread for the ThreadPool

Author:
Peter Kharchenko pkharchenko@interactivebusiness.com

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  ThreadPoolReceipt currentReceipt
           
private static org.apache.commons.logging.Log log
           
private static int nextWorkerID
           
private  ThreadPool pool
           
protected  boolean shouldQuit
           
protected  boolean shouldRestart
           
private  BlockingQueue taskQueue
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadPoolWorker(ThreadPool pool)
           
 
Method Summary
 boolean completeRequest()
           
static java.lang.String getNextWorkerID()
           
 void killRequest()
           
 ThreadPoolReceipt process(java.lang.Runnable target)
           
 void run()
           
private  void runIt(java.lang.Runnable r)
           
private  void runWork()
           
 void stopRequest()
           
 
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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

nextWorkerID

private static int nextWorkerID

pool

private ThreadPool pool

taskQueue

private BlockingQueue taskQueue

currentReceipt

protected ThreadPoolReceipt currentReceipt

shouldRestart

protected volatile boolean shouldRestart

shouldQuit

protected volatile boolean shouldQuit
Constructor Detail

ThreadPoolWorker

public ThreadPoolWorker(ThreadPool pool)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getNextWorkerID

public static java.lang.String getNextWorkerID()

process

public ThreadPoolReceipt process(java.lang.Runnable target)
                          throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

runWork

private void runWork()
              throws java.lang.RuntimeException
Throws:
java.lang.RuntimeException

runIt

private void runIt(java.lang.Runnable r)
            throws java.lang.RuntimeException
Throws:
java.lang.RuntimeException

completeRequest

public boolean completeRequest()

stopRequest

public void stopRequest()

killRequest

public void killRequest()