|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.netseeker.ejoe.concurrent.ThreadPool
public class ThreadPool
Fixed size thread pool implementation for usage with java < 1.5.0
Constructor Summary | |
---|---|
ThreadPool()
|
|
ThreadPool(int numberOfThreads)
|
|
ThreadPool(int numberOfThreads,
int threadPriority)
|
|
ThreadPool(java.lang.ThreadGroup threadGroup)
|
|
ThreadPool(java.lang.ThreadGroup threadGroup,
int numberOfThreads)
|
Method Summary | |
---|---|
int |
getActiveWorkerCount()
Returns the count of currently active worker threads |
java.lang.Thread[] |
getAllWorkers()
|
int |
getCurrentPoolsize()
Returns the real pool size which is the count of all living worker threads in the pool |
int |
getExpectedPoolsize()
Returns the expected pool size, which might differ from the real pool size because workers died caused by unexpected exceptions etc. |
int |
getRunnableCount()
Returns number of runnable object in the queue. |
void |
invokeLater(java.lang.Runnable task)
Dispatch a new task onto this pool to be invoked asynchronously later |
void |
resize(int poolSize)
Resizes the pool to the new size |
void |
run()
The method ran by the pool of background threads |
void |
stop()
Signals this pool not to request and run workers from the queue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadPool(int numberOfThreads, int threadPriority)
numberOfThreads
- threadPriority
- public ThreadPool(int numberOfThreads)
numberOfThreads
- public ThreadPool()
public ThreadPool(java.lang.ThreadGroup threadGroup)
threadGroup
- public ThreadPool(java.lang.ThreadGroup threadGroup, int numberOfThreads)
threadGroup
- numberOfThreads
- Method Detail |
---|
public void stop()
stop
in interface ThreadService
public int getRunnableCount()
public void invokeLater(java.lang.Runnable task)
invokeLater
in interface ThreadService
task
- a task to execute within one of the available worker threadspublic java.lang.Thread[] getAllWorkers()
public int getActiveWorkerCount()
getActiveWorkerCount
in interface ThreadService
public int getExpectedPoolsize()
getExpectedPoolsize
in interface ThreadService
public int getCurrentPoolsize()
getCurrentPoolsize
in interface ThreadService
public void resize(int poolSize)
resize
in interface ThreadService
numberOfThreads
- the new pool sizepublic void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |