Package org.biojava.utils
Interface ThreadPool
-
- All Known Implementing Classes:
SimpleThreadPool
public interface ThreadPool
ThreadPoolspecifies basic thread-pooling operations such that third-party implementations may be used without requiring changes to BioJava.- Since:
- 1.3
- Author:
- Keith James
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddRequest(Runnable task)addRequestrequests that aRunnablebe scheduled to be run by one of the threads in the pool.voidstartThreads()startThreadsstarts all the threads running and opens the pool to requests.voidstopThreads()stopThreadscauses all running threads to stop when their current task is complete.voidwaitForThreads()waitForThreadstemporarily closes the pool to new requests until such time as the current request queue has been emptied and all running tasks completed.
-
-
-
Method Detail
-
addRequest
void addRequest(Runnable task)
addRequestrequests that aRunnablebe scheduled to be run by one of the threads in the pool.- Parameters:
task- aRunnable.
-
startThreads
void startThreads()
startThreadsstarts all the threads running and opens the pool to requests.
-
stopThreads
void stopThreads()
stopThreadscauses all running threads to stop when their current task is complete. It also closes the pool to new requests. Requests still queued are not done and the queue is emptied.
-
waitForThreads
void waitForThreads()
waitForThreadstemporarily closes the pool to new requests until such time as the current request queue has been emptied and all running tasks completed.
-
-