Package org.biojava.utils
Interface ThreadPool
- All Known Implementing Classes:
SimpleThreadPool
public interface ThreadPool
ThreadPool specifies 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
Modifier and TypeMethodDescriptionvoidaddRequest(Runnable task) addRequestrequests that aRunnablebe scheduled to be run by one of the threads in the pool.voidstartThreadsstarts all the threads running and opens the pool to requests.voidstopThreadscauses all running threads to stop when their current task is complete.voidwaitForThreadstemporarily closes the pool to new requests until such time as the current request queue has been emptied and all running tasks completed.
-
Method Details
-
addRequest
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.
-