public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor
Uses Daemon threads and hooks into shutdown event.
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
DaemonScheduleThreadPool(int coreSize,
int shutdownWaitSeconds,
String namePrefix)
Construct the DaemonScheduleThreadPool.
|
| Modifier and Type | Method and Description |
|---|---|
void |
registerShutdownHook()
Register a shutdown hook with the JVM Runtime.
|
void |
shutdown()
Shutdown this thread pool nicely if possible.
|
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdownNow, submit, submit, submitafterExecute, allowCoreThreadTimeOut, 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, newTaskForclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitawaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedpublic DaemonScheduleThreadPool(int coreSize,
int shutdownWaitSeconds,
String namePrefix)
public void registerShutdownHook()
public void shutdown()
This will wait a maximum of 20 seconds before terminating any threads still working.
shutdown in interface ExecutorServiceshutdown in class ScheduledThreadPoolExecutorCopyright © 2014. All Rights Reserved.