public class MdcThreadPoolTaskExecutor
extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
ThreadPoolExecutor.
In general, MDC is used to store diagnostic information (e.g. logfile name) in per-thread variables, to facilitate logging. However, although MDC
data is passed to thread children, this doesn't work when threads are reused in a thread pool. This is a drop-in replacement for
ThreadPoolTaskExecutor sets MDC data before each task appropriately.
| Constructor and Description |
|---|
MdcThreadPoolTaskExecutor() |
MdcThreadPoolTaskExecutor(Map<String,String> fixedContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Runnable command)
All executions will have MDC injected.
|
static Runnable |
wrap(Runnable runnable,
Map<String,String> context) |
createQueue, execute, getActiveCount, getCorePoolSize, getKeepAliveSeconds, getMaxPoolSize, getPoolSize, getThreadPoolExecutor, initializeExecutor, prefersShortLivedTasks, setAllowCoreThreadTimeOut, setCorePoolSize, setKeepAliveSeconds, setMaxPoolSize, setQueueCapacity, setTaskDecorator, submit, submit, submitListenable, submitListenableafterPropertiesSet, destroy, initialize, setAwaitTerminationSeconds, setBeanName, setRejectedExecutionHandler, setThreadFactory, setThreadNamePrefix, setWaitForTasksToCompleteOnShutdown, shutdownnewThreadpublic void execute(Runnable command)
ThreadPoolExecutor's submission methods (submit() etc.)
all delegate to this.Copyright © 2016. All Rights Reserved.