Package adams.multiprocess
Class PausableFixedThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- adams.multiprocess.PausableFixedThreadPoolExecutor
-
- All Implemented Interfaces:
Pausable
,Executor
,ExecutorService
public class PausableFixedThreadPoolExecutor extends ThreadPoolExecutor implements Pausable
The thread pool executor for theLocalJobRunner
class.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
LocalJobRunner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_IsPaused
whether the executor is paused.protected ReentrantLock
m_PauseLock
for pausing.protected Condition
m_Unpaused
for resuming.
-
Constructor Summary
Constructors Constructor Description PausableFixedThreadPoolExecutor(int numThreads)
Initializes the thread pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
beforeExecute(Thread t, Runnable r)
boolean
isPaused()
Returns whether the object is currently paused.void
pauseExecution()
Pauses the execution.void
resumeExecution()
Resumes the execution.-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Field Detail
-
m_IsPaused
protected boolean m_IsPaused
whether the executor is paused.
-
m_PauseLock
protected ReentrantLock m_PauseLock
for pausing.
-
m_Unpaused
protected Condition m_Unpaused
for resuming.
-
-
Method Detail
-
beforeExecute
protected void beforeExecute(Thread t, Runnable r)
- Overrides:
beforeExecute
in classThreadPoolExecutor
-
isPaused
public boolean isPaused()
Returns whether the object is currently paused.
-
pauseExecution
public void pauseExecution()
Pauses the execution.- Specified by:
pauseExecution
in interfacePausable
-
resumeExecution
public void resumeExecution()
Resumes the execution.- Specified by:
resumeExecution
in interfacePausable
-
-