public class ComputationExecutor extends ThreadPoolExecutor
ExecutorService for starting a several copies of runnable
tasks, and waiting for it computation; it allows to interrupt all running
tasks without shutting down the ExecutorService. If terminated, the
tasks can be started again.ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
ComputationExecutor(int threadCount,
ComputationThreadGroup threadGroup)
Create a
ComputationExecutor with a given maximal number of
threads and the given thread group |
ComputationExecutor(int threadCount,
String name)
Create a
ComputationExecutor with a given maximal number of
threads and the the given name which is used to identify threads |
| Modifier and Type | Method and Description |
|---|---|
void |
interrupt()
Interrupting all threads of this executor (used to wake up waiting
threads if something needs to be notified)
|
boolean |
start(Runnable job,
int noCopies)
Starts a several copies of jobs.
|
void |
waitDone()
Waits until all computations are done
|
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic ComputationExecutor(int threadCount,
ComputationThreadGroup threadGroup)
ComputationExecutor with a given maximal number of
threads and the given thread groupthreadCount - threadGroup - public ComputationExecutor(int threadCount,
String name)
ComputationExecutor with a given maximal number of
threads and the the given name which is used to identify threadsthreadCount - name - public boolean start(Runnable job, int noCopies)
waitDone() is calledjob - noCopies - true if the jobs have been startedpublic void interrupt()
public void waitDone()
throws InterruptedException
InterruptedException - if was interrupted while waitingCopyright © 2011-2015 Department of Computer Science, University of Oxford. All Rights Reserved.