|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.garret.jsql.ThreadPool
Pool of threads used to minimize overhead of creation new threads each time it is needed
Constructor Summary | |
ThreadPool()
Constructor of thread pool with unlimited number of threads |
|
ThreadPool(int maxThreads)
Constructor of thread pool with limited number of threads |
Method Summary | |
void |
close()
Wait termination of all active tasks and stop all threads in thread pool |
static ThreadPool |
getInstance()
Get instance of thread pool |
void |
join(java.lang.Thread thread)
Wait completion of task |
java.lang.Thread |
start(java.lang.Runnable task)
Get thread from thread pool and start specified task in this thread |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ThreadPool(int maxThreads)
public ThreadPool()
Method Detail |
public static ThreadPool getInstance()
public java.lang.Thread start(java.lang.Runnable task)
task
- class impkemeting Runnable interface which run method will be executed by pooled thread
ThreadPool.join
method)public void join(java.lang.Thread thread) throws java.lang.InterruptedException
thread
- pooled thread assigned to the task by ThreadPool.start
method
java.lang.InterruptedException
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |