public class DebuggableThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor implements LocalAwareExecutorService
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and Description |
---|---|
static java.util.concurrent.RejectedExecutionHandler |
blockingExecutionHandler |
protected static org.slf4j.Logger |
logger |
Constructor and Description |
---|
DebuggableThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory) |
DebuggableThreadPoolExecutor(int corePoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> queue,
java.util.concurrent.ThreadFactory factory) |
DebuggableThreadPoolExecutor(java.lang.String threadPoolName,
int priority) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterExecute(java.lang.Runnable r,
java.lang.Throwable t) |
protected void |
beforeExecute(java.lang.Thread t,
java.lang.Runnable r) |
static DebuggableThreadPoolExecutor |
createCachedThreadpoolWithMaxSize(java.lang.String threadPoolName)
Creates a thread pool that creates new threads as needed, but
will reuse previously constructed threads when they are
available.
|
static DebuggableThreadPoolExecutor |
createWithFixedPoolSize(java.lang.String threadPoolName,
int size)
Returns a ThreadPoolExecutor with a fixed number of threads.
|
static DebuggableThreadPoolExecutor |
createWithMaximumPoolSize(java.lang.String threadPoolName,
int size,
int keepAliveTime,
java.util.concurrent.TimeUnit unit)
Returns a ThreadPoolExecutor with a fixed maximum number of threads, but whose
threads are terminated when idle for too long.
|
void |
execute(java.lang.Runnable command) |
void |
execute(java.lang.Runnable command,
ExecutorLocals locals) |
static java.lang.Throwable |
extractThrowable(java.lang.Runnable runnable) |
static void |
handleOrLog(java.lang.Throwable t)
Send @param t to the default uncaught exception handler, or log it if none such is set up
|
static void |
logExceptionsAfterExecute(java.lang.Runnable r,
java.lang.Throwable t)
Send @param t and any exception wrapped by @param r to the default uncaught exception handler,
or log them if none such is set up
|
void |
maybeExecuteImmediately(java.lang.Runnable command) |
protected static void |
maybeResetTraceSessionWrapper(java.lang.Runnable r) |
protected <T> java.util.concurrent.RunnableFuture<T> |
newTaskFor(java.util.concurrent.Callable<T> callable) |
protected <T> java.util.concurrent.RunnableFuture<T> |
newTaskFor(java.lang.Runnable runnable,
T result) |
protected void |
onFinalAccept(java.lang.Runnable task) |
protected void |
onFinalRejection(java.lang.Runnable task) |
protected void |
onInitialRejection(java.lang.Runnable task) |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
protected static final org.slf4j.Logger logger
public static final java.util.concurrent.RejectedExecutionHandler blockingExecutionHandler
public DebuggableThreadPoolExecutor(java.lang.String threadPoolName, int priority)
public DebuggableThreadPoolExecutor(int corePoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> queue, java.util.concurrent.ThreadFactory factory)
public DebuggableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.ThreadFactory threadFactory)
public static DebuggableThreadPoolExecutor createCachedThreadpoolWithMaxSize(java.lang.String threadPoolName)
threadPoolName
- the name of the threads created by this executorpublic static DebuggableThreadPoolExecutor createWithFixedPoolSize(java.lang.String threadPoolName, int size)
threadPoolName
- the name of the threads created by this executorsize
- the fixed number of threads for this executorpublic static DebuggableThreadPoolExecutor createWithMaximumPoolSize(java.lang.String threadPoolName, int size, int keepAliveTime, java.util.concurrent.TimeUnit unit)
threadPoolName
- the name of the threads created by this executorsize
- the maximum number of threads for this executorkeepAliveTime
- the time an idle thread is kept alive before being terminatedunit
- tht time unit for keepAliveTime
protected void onInitialRejection(java.lang.Runnable task)
protected void onFinalAccept(java.lang.Runnable task)
protected void onFinalRejection(java.lang.Runnable task)
public void execute(java.lang.Runnable command, ExecutorLocals locals)
execute
in interface LocalAwareExecutorService
public void maybeExecuteImmediately(java.lang.Runnable command)
maybeExecuteImmediately
in interface LocalAwareExecutorService
public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
execute
in class java.util.concurrent.ThreadPoolExecutor
protected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable, T result)
newTaskFor
in class java.util.concurrent.AbstractExecutorService
protected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable)
newTaskFor
in class java.util.concurrent.AbstractExecutorService
protected void afterExecute(java.lang.Runnable r, java.lang.Throwable t)
afterExecute
in class java.util.concurrent.ThreadPoolExecutor
protected static void maybeResetTraceSessionWrapper(java.lang.Runnable r)
protected void beforeExecute(java.lang.Thread t, java.lang.Runnable r)
beforeExecute
in class java.util.concurrent.ThreadPoolExecutor
public static void logExceptionsAfterExecute(java.lang.Runnable r, java.lang.Throwable t)
public static void handleOrLog(java.lang.Throwable t)
public static java.lang.Throwable extractThrowable(java.lang.Runnable runnable)
Copyright © 2018 The Apache Software Foundation