|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fipaos.util.ThreadPool
Implements a pool of Threads - enables multiple threads to be used within an apllication without the associated overhead of starting new Threads, since Threads are re-used
Inner Class Summary | |
static interface |
ThreadPool.Job
Interface to be implemented by objects to be executed by threads within a ThreadPool |
class |
ThreadPool.TPThread
Extends Thread to provide the ThreadGroup of the thread that requested the Job be carried out |
Constructor Summary | |
ThreadPool(int number_of_threads,
java.lang.String name)
Create a thread pool with the specified number of threads, and a name to use as a prefix for the thread names |
Method Summary | |
void |
addJob(ThreadPool.Job job)
Add a Job to be executed by the ThreadPool |
int |
getActiveThreadCount()
Get the number of active threads |
static ThreadPool |
getGlobalThreadPool()
Get the global thread-pool |
java.lang.String |
getName()
Get the name of the thread pool |
int |
getThreadCount()
Get the number of threads |
static java.util.Set |
getThreadPools()
Get a set of all thread-pools |
long |
getTotalActiveTime()
Get the number of active threads |
long |
getTotalInactiveTime()
Get the number of threads |
int |
getWaitingJobCount()
Get the number of waiting Jobs |
static void |
main(java.lang.String[] args)
Test harness |
void |
run()
Invoked by each thread in the ThreadPool |
void |
shutdown()
Terminate all threads & stop executing pending jobs - doesn't block |
java.lang.String |
toString()
Returns name of ThreadPool |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ThreadPool(int number_of_threads, java.lang.String name)
Method Detail |
public void run()
run
in interface java.lang.Runnable
public void addJob(ThreadPool.Job job)
public void shutdown()
public java.lang.String getName()
public int getActiveThreadCount()
public int getThreadCount()
public long getTotalActiveTime()
public long getTotalInactiveTime()
public int getWaitingJobCount()
public java.lang.String toString()
toString
in class java.lang.Object
public static ThreadPool getGlobalThreadPool()
public static java.util.Set getThreadPools()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |