Class LazyTraceThreadPoolTaskExecutor
java.lang.Object
org.springframework.util.CustomizableThreadCreator
org.springframework.scheduling.concurrent.CustomizableThreadFactory
org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
org.springframework.cloud.sleuth.instrument.async.LazyTraceThreadPoolTaskExecutor
- All Implemented Interfaces:
Serializable,Executor,ThreadFactory,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.core.task.AsyncListenableTaskExecutor,org.springframework.core.task.AsyncTaskExecutor,org.springframework.core.task.TaskExecutor,org.springframework.scheduling.SchedulingTaskExecutor
public class LazyTraceThreadPoolTaskExecutor
extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
Trace representation of
ThreadPoolTaskExecutor.- Since:
- 1.0.10
- Author:
- Marcin Grzejszczak
- See Also:
-
Field Summary
Fields inherited from class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
loggerFields inherited from interface org.springframework.core.task.AsyncTaskExecutor
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE -
Constructor Summary
ConstructorsConstructorDescriptionLazyTraceThreadPoolTaskExecutor(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate) LazyTraceThreadPoolTaskExecutor(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate, String beanName) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateThread(Runnable runnable) voiddestroy()voidvoidintintintintintintintvoidbooleanisDaemon()booleanvoidsetAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) voidsetAwaitTerminationSeconds(int awaitTerminationSeconds) voidsetBeanName(String name) voidsetCorePoolSize(int corePoolSize) voidsetDaemon(boolean daemon) voidsetKeepAliveSeconds(int keepAliveSeconds) voidsetMaxPoolSize(int maxPoolSize) voidsetQueueCapacity(int queueCapacity) voidsetRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) voidsetTaskDecorator(org.springframework.core.task.TaskDecorator taskDecorator) voidsetThreadFactory(ThreadFactory threadFactory) voidsetThreadGroup(ThreadGroup threadGroup) voidsetThreadGroupName(String name) voidsetThreadNamePrefix(String threadNamePrefix) voidsetThreadPriority(int threadPriority) voidsetWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) voidshutdown()Future<?><T> Future<T>org.springframework.util.concurrent.ListenableFuture<?>submitListenable(Runnable task) <T> org.springframework.util.concurrent.ListenableFuture<T>submitListenable(Callable<T> task) wrap(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate) Wraps the Executor in a trace instance.wrap(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate, String beanName) Wraps the Executor in a trace instance.Methods inherited from class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
cancelRemainingTask, createQueue, getQueueSize, initializeExecutor, setPrestartAllCoreThreadsMethods inherited from class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
setAwaitTerminationMillisMethods inherited from class org.springframework.util.CustomizableThreadCreator
getDefaultThreadNamePrefix, nextThreadName
-
Constructor Details
-
LazyTraceThreadPoolTaskExecutor
public LazyTraceThreadPoolTaskExecutor(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate) -
LazyTraceThreadPoolTaskExecutor
public LazyTraceThreadPoolTaskExecutor(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate, String beanName)
-
-
Method Details
-
wrap
public static LazyTraceThreadPoolTaskExecutor wrap(org.springframework.beans.factory.BeanFactory beanFactory, @NonNull org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate, String beanName) Wraps the Executor in a trace instance.- Parameters:
beanFactory- bean factorydelegate- delegate to wrapbeanName- bean name- Returns:
- traced instance
-
wrap
public static LazyTraceThreadPoolTaskExecutor wrap(org.springframework.beans.factory.BeanFactory beanFactory, @NonNull org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate) Wraps the Executor in a trace instance.- Parameters:
beanFactory- bean factorydelegate- delegate to wrap- Returns:
- traced instance
-
execute
-
execute
- Specified by:
executein interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
executein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submit
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
submitin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submit
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
submitin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submitListenable
- Specified by:
submitListenablein interfaceorg.springframework.core.task.AsyncListenableTaskExecutor- Overrides:
submitListenablein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submitListenable
public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task) - Specified by:
submitListenablein interfaceorg.springframework.core.task.AsyncListenableTaskExecutor- Overrides:
submitListenablein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
prefersShortLivedTasks
public boolean prefersShortLivedTasks() -
setThreadFactory
- Overrides:
setThreadFactoryin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
setRejectedExecutionHandler
- Overrides:
setRejectedExecutionHandlerin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
setWaitForTasksToCompleteOnShutdown
public void setWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) - Overrides:
setWaitForTasksToCompleteOnShutdownin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
setAwaitTerminationSeconds
public void setAwaitTerminationSeconds(int awaitTerminationSeconds) - Overrides:
setAwaitTerminationSecondsin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware- Overrides:
setBeanNamein classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
getThreadPoolExecutor
- Overrides:
getThreadPoolExecutorin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor- Throws:
IllegalStateException
-
getPoolSize
public int getPoolSize()- Overrides:
getPoolSizein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
getActiveCount
public int getActiveCount()- Overrides:
getActiveCountin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
getQueueCapacity
public int getQueueCapacity()- Overrides:
getQueueCapacityin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Overrides:
destroyin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
initialize
public void initialize()- Overrides:
initializein classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
shutdown
public void shutdown()- Overrides:
shutdownin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
newThread
- Specified by:
newThreadin interfaceThreadFactory- Overrides:
newThreadin classorg.springframework.scheduling.concurrent.CustomizableThreadFactory
-
getThreadNamePrefix
- Overrides:
getThreadNamePrefixin classorg.springframework.util.CustomizableThreadCreator
-
setThreadNamePrefix
- Overrides:
setThreadNamePrefixin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
getThreadPriority
public int getThreadPriority()- Overrides:
getThreadPriorityin classorg.springframework.util.CustomizableThreadCreator
-
setThreadPriority
public void setThreadPriority(int threadPriority) - Overrides:
setThreadPriorityin classorg.springframework.util.CustomizableThreadCreator
-
isDaemon
public boolean isDaemon()- Overrides:
isDaemonin classorg.springframework.util.CustomizableThreadCreator
-
setDaemon
public void setDaemon(boolean daemon) - Overrides:
setDaemonin classorg.springframework.util.CustomizableThreadCreator
-
setThreadGroupName
- Overrides:
setThreadGroupNamein classorg.springframework.util.CustomizableThreadCreator
-
getThreadGroup
- Overrides:
getThreadGroupin classorg.springframework.util.CustomizableThreadCreator
-
setThreadGroup
- Overrides:
setThreadGroupin classorg.springframework.util.CustomizableThreadCreator
-
createThread
- Overrides:
createThreadin classorg.springframework.util.CustomizableThreadCreator
-
getCorePoolSize
public int getCorePoolSize()- Overrides:
getCorePoolSizein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize) - Overrides:
setCorePoolSizein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
getMaxPoolSize
public int getMaxPoolSize()- Overrides:
getMaxPoolSizein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setMaxPoolSize
public void setMaxPoolSize(int maxPoolSize) - Overrides:
setMaxPoolSizein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
getKeepAliveSeconds
public int getKeepAliveSeconds()- Overrides:
getKeepAliveSecondsin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setKeepAliveSeconds
public void setKeepAliveSeconds(int keepAliveSeconds) - Overrides:
setKeepAliveSecondsin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setQueueCapacity
public void setQueueCapacity(int queueCapacity) - Overrides:
setQueueCapacityin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setAllowCoreThreadTimeOut
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) - Overrides:
setAllowCoreThreadTimeOutin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
setTaskDecorator
public void setTaskDecorator(org.springframework.core.task.TaskDecorator taskDecorator) - Overrides:
setTaskDecoratorin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-