public class ScheduledCaughtExecutorService
extends java.util.concurrent.ScheduledThreadPoolExecutor
ScheduledThreadPoolExecutor that can additionally perform actions after thread has completed normally.
Consider seeing java.util.concurrent.ThreadPoolExecutor#afterExecute(Runnable, Throwable)ScheduledThreadPoolExecutor,
afterExecute(Runnable, Throwable),
addAfterExecuteConsumer(BiConsumer)java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
ScheduledCaughtExecutorService(int corePoolSize) |
ScheduledCaughtExecutorService(int corePoolSize,
java.util.concurrent.ThreadFactory threadFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAfterExecuteConsumer(java.util.function.BiConsumer<java.lang.Runnable,java.lang.Throwable> afterExecuteBiConsumer) |
void |
afterExecute(java.lang.Runnable runnable,
java.lang.Throwable throwable)
Method invoked upon completion of execution of the given Runnable.
|
java.util.List<java.util.function.BiConsumer<java.lang.Runnable,java.lang.Throwable>> |
getAfterExecuteConsumers() |
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submitallowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskForpublic ScheduledCaughtExecutorService(int corePoolSize)
corePoolSize - the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut is setScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int)public ScheduledCaughtExecutorService(int corePoolSize,
java.util.concurrent.ThreadFactory threadFactory)
corePoolSize - the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut is setthreadFactory - the factory to use when the executor creates a new threadScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, ThreadFactory)public void afterExecute(java.lang.Runnable runnable,
java.lang.Throwable throwable)
RuntimeException
or Error that caused execution to terminate abruptly.
This method will consume a list of java.util.function.BiConsumer with a runnable and a throwable as
arguments. See addAfterExecuteConsumer(BiConsumer)afterExecute in class java.util.concurrent.ThreadPoolExecutorrunnable - the runnable that has completedthrowable - the exception that caused termination, or null if execution completed normallypublic java.util.List<java.util.function.BiConsumer<java.lang.Runnable,java.lang.Throwable>> getAfterExecuteConsumers()
public void addAfterExecuteConsumer(java.util.function.BiConsumer<java.lang.Runnable,java.lang.Throwable> afterExecuteBiConsumer)
afterExecuteBiConsumer - the consumer that will be performed after thread has completed normally.