Package org.apache.cassandra.concurrent
Class DebuggableScheduledThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- java.util.concurrent.ScheduledThreadPoolExecutor
-
- org.apache.cassandra.concurrent.DebuggableScheduledThreadPoolExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.concurrent.ScheduledExecutorService
public class DebuggableScheduledThreadPoolExecutor extends java.util.concurrent.ScheduledThreadPoolExecutor
Like DebuggableThreadPoolExecutor, DebuggableScheduledThreadPoolExecutor always logs exceptions from the tasks it is given, even if Future.get is never called elsewhere. DebuggableScheduledThreadPoolExecutor also catches exceptions during Task execution so that they don't supress subsequent invocations of the task. Finally, there is a special rejected execution handler for tasks rejected during the shutdown hook. For fire and forget tasks (like ref tidy) we can safely ignore the exceptions. For any callers that care to know their task was rejected we cancel passed task.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.RejectedExecutionHandler
rejectedExecutionHandler
-
Constructor Summary
Constructors Constructor Description DebuggableScheduledThreadPoolExecutor(int corePoolSize, java.lang.String threadPoolName, int priority)
DebuggableScheduledThreadPoolExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
DebuggableScheduledThreadPoolExecutor(java.lang.String threadPoolName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterExecute(java.lang.Runnable r, java.lang.Throwable t)
java.util.concurrent.ScheduledFuture<?>
scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
java.util.concurrent.ScheduledFuture<?>
scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
-
Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submit
-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
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, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
-
-
-
-
Constructor Detail
-
DebuggableScheduledThreadPoolExecutor
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, java.lang.String threadPoolName, int priority)
-
DebuggableScheduledThreadPoolExecutor
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
-
DebuggableScheduledThreadPoolExecutor
public DebuggableScheduledThreadPoolExecutor(java.lang.String threadPoolName)
-
-
Method Detail
-
afterExecute
public void afterExecute(java.lang.Runnable r, java.lang.Throwable t)
- Overrides:
afterExecute
in classjava.util.concurrent.ThreadPoolExecutor
-
scheduleAtFixedRate
public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
- Specified by:
scheduleAtFixedRate
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
scheduleAtFixedRate
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
- Specified by:
scheduleWithFixedDelay
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
scheduleWithFixedDelay
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
-