Package pl.morgwai.base.utils.concurrent
Class TaskTrackingThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- pl.morgwai.base.utils.concurrent.TaskTrackingThreadPoolExecutor
-
- All Implemented Interfaces:
Executor,ExecutorService,TaskTrackingExecutor
public class TaskTrackingThreadPoolExecutor extends ThreadPoolExecutor implements TaskTrackingExecutor
ATaskTrackingExecutorbased on aThreadPoolExecutor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Nested classes/interfaces inherited from interface pl.morgwai.base.utils.concurrent.TaskTrackingExecutor
TaskTrackingExecutor.ForcedTerminationAftermath, TaskTrackingExecutor.TaskTrackingExecutorDecorator
-
-
Constructor Summary
Constructors Constructor Description TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(Runnable task, Throwable error)Subclasses must callsuper.protected voidbeforeExecute(Thread worker, Runnable task)Subclasses must callsuper.TaskTrackingExecutor.ForcedTerminationAftermathtryForceTerminate()CallsExecutorService.shutdownNow()and returns an object containing a list of tasks that were still running when this method was called, together with the list of tasks returned byExecutorService.shutdownNow().-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
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
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
-
Methods inherited from interface pl.morgwai.base.utils.concurrent.TaskTrackingExecutor
awaitTermination, toAwaitableOfEnforcedTermination, toAwaitableOfTermination
-
-
-
-
Constructor Detail
-
TaskTrackingThreadPoolExecutor
public TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
-
TaskTrackingThreadPoolExecutor
public TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)
-
TaskTrackingThreadPoolExecutor
public TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)
-
TaskTrackingThreadPoolExecutor
public TaskTrackingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
-
Method Detail
-
beforeExecute
protected void beforeExecute(Thread worker, Runnable task)
Subclasses must callsuper.- Overrides:
beforeExecutein classThreadPoolExecutor
-
afterExecute
protected void afterExecute(Runnable task, Throwable error)
Subclasses must callsuper.- Overrides:
afterExecutein classThreadPoolExecutor
-
tryForceTerminate
public TaskTrackingExecutor.ForcedTerminationAftermath tryForceTerminate()
Description copied from interface:TaskTrackingExecutorCallsExecutorService.shutdownNow()and returns an object containing a list of tasks that were still running when this method was called, together with the list of tasks returned byExecutorService.shutdownNow().- Specified by:
tryForceTerminatein interfaceTaskTrackingExecutor
-
-