public class InterruptibleMulticoreWrapper<I,O> extends MulticoreWrapper<I,O>
| Constructor and Description |
|---|
InterruptibleMulticoreWrapper(int numThreads,
ThreadsafeProcessor<I,O> processor,
boolean orderResults,
long timeout) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
After a shutdown request, await for the final termination of all
threads.
|
protected ThreadPoolExecutor |
buildThreadPool(int nThreads) |
protected Integer |
getProcessor()
Returns the next available thread id.
|
List<I> |
joinWithTimeout()
Shuts down the thread pool, returns when finished.
|
public InterruptibleMulticoreWrapper(int numThreads,
ThreadsafeProcessor<I,O> processor,
boolean orderResults,
long timeout)
protected ThreadPoolExecutor buildThreadPool(int nThreads)
buildThreadPool in class MulticoreWrapper<I,O>protected Integer getProcessor()
MulticoreWrapperpublic List<I> joinWithTimeout()
timeout was set, then join waits at
most timeout milliseconds for threads to finish. If
any fail to finish in that time, the threadpool is shutdownNow.
After that, join continues to wait for the
interrupted threads to finish, so if job do not obey
interruptions, they can continue indefinitely regardless of the
timeout.timeout was reached, or null if that did not
happen.public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
InterruptedException