|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ThreadGroup
org.jasig.portal.utils.ThreadPool
public class ThreadPool
A thread pool implementation with a few extra kinks, such as ThreadPoolReceipt.
Field Summary | |
---|---|
(package private) BlockingStack |
idleWorkers
|
(package private) ResourceLimits |
limits
|
private static org.apache.commons.logging.Log |
log
|
(package private) java.util.List |
workers
|
Constructor Summary | |
---|---|
ThreadPool(java.lang.String name,
ResourceLimits rl)
|
Method Summary | |
---|---|
protected void |
addNewWorker()
Adds a new worker. |
protected void |
addWorker()
Grow the size of the worker pool. |
protected void |
adjustSize(int newSize)
Adjust the size of the worker pool. |
void |
clear()
Clears all of the workers. |
void |
clearIdle()
Clears all of the idle workers |
ThreadPoolReceipt |
execute(java.lang.Runnable target)
|
protected void |
killWorkerThread(ThreadPoolWorker pw)
|
protected void |
notifyWorkerFinished(ThreadPoolWorker pw)
Notifies the pool that a certain worker has finished. |
protected void |
notifyWorkerRestart(ThreadPoolWorker pw)
Notifies the pool that a certain worker is done and wants to have a replacement started. |
protected boolean |
releaseWorker(ThreadPoolWorker worker)
Signals the worker that it should quite as soon as a job (if any) is complete |
protected void |
stopWorker(ThreadPoolWorker worker)
Signals the worker that it try to interrupt the current job and quit. |
void |
uncaughtException(java.lang.Thread t,
java.lang.Throwable e)
Handle the case when some worker crashes |
Methods inherited from class java.lang.ThreadGroup |
---|
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log log
BlockingStack idleWorkers
java.util.List workers
ResourceLimits limits
Constructor Detail |
---|
public ThreadPool(java.lang.String name, ResourceLimits rl)
Method Detail |
---|
public ThreadPoolReceipt execute(java.lang.Runnable target) throws java.lang.InterruptedException
java.lang.InterruptedException
protected void adjustSize(int newSize)
protected void addWorker()
protected void stopWorker(ThreadPoolWorker worker)
protected boolean releaseWorker(ThreadPoolWorker worker)
protected void addNewWorker()
public void clearIdle()
public void clear()
public void uncaughtException(java.lang.Thread t, java.lang.Throwable e)
uncaughtException
in interface java.lang.Thread.UncaughtExceptionHandler
uncaughtException
in class java.lang.ThreadGroup
protected void notifyWorkerRestart(ThreadPoolWorker pw)
protected void killWorkerThread(ThreadPoolWorker pw)
protected void notifyWorkerFinished(ThreadPoolWorker pw)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |