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 theLocalJobRunnerclass.- 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 booleanm_IsPausedwhether the executor is paused.protected ReentrantLockm_PauseLockfor pausing.protected Conditionm_Unpausedfor 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 voidbeforeExecute(Thread t, Runnable r)booleanisPaused()Returns whether the object is currently paused.voidpauseExecution()Pauses the execution.voidresumeExecution()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:
beforeExecutein classThreadPoolExecutor
-
isPaused
public boolean isPaused()
Returns whether the object is currently paused.
-
pauseExecution
public void pauseExecution()
Pauses the execution.- Specified by:
pauseExecutionin interfacePausable
-
resumeExecution
public void resumeExecution()
Resumes the execution.- Specified by:
resumeExecutionin interfacePausable
-
-