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.ThreadPoolTaskExecutorTrace representation ofThreadPoolTaskExecutor.- Since:
- 1.0.10
- Author:
- Marcin Grzejszczak
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LazyTraceThreadPoolTaskExecutor(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()ThreadcreateThread(Runnable runnable)voiddestroy()voidexecute(Runnable task)voidexecute(Runnable task, long startTimeout)intgetActiveCount()intgetCorePoolSize()intgetKeepAliveSeconds()intgetMaxPoolSize()intgetPoolSize()intgetQueueCapacity()intgetQueueSize()ThreadGroupgetThreadGroup()StringgetThreadNamePrefix()ThreadPoolExecutorgetThreadPoolExecutor()intgetThreadPriority()voidinitialize()booleanisDaemon()ThreadnewThread(Runnable runnable)booleanprefersShortLivedTasks()voidsetAllowCoreThreadTimeOut(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<?>submit(Runnable task)<T> Future<T>submit(Callable<T> task)org.springframework.util.concurrent.ListenableFuture<?>submitListenable(Runnable task)<T> org.springframework.util.concurrent.ListenableFuture<T>submitListenable(Callable<T> task)static LazyTraceThreadPoolTaskExecutorwrap(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor delegate)Wraps the Executor in a trace instance.static LazyTraceThreadPoolTaskExecutorwrap(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, initializeExecutor, setPrestartAllCoreThreads
-
Methods inherited from class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
setAwaitTerminationMillis
-
-
-
-
Constructor Detail
-
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 Detail
-
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
public void execute(Runnable task)
-
execute
public void execute(Runnable task, long startTimeout)
- Specified by:
executein interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
executein classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submit
public Future<?> submit(Runnable task)
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
submitin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submit
public <T> Future<T> submit(Callable<T> task)
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor- Overrides:
submitin classorg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-
submitListenable
public org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task)
- 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
public void setThreadFactory(ThreadFactory threadFactory)
- Overrides:
setThreadFactoryin classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
setRejectedExecutionHandler
public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
- 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
public void setBeanName(String name)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware- Overrides:
setBeanNamein classorg.springframework.scheduling.concurrent.ExecutorConfigurationSupport
-
getThreadPoolExecutor
public ThreadPoolExecutor getThreadPoolExecutor() throws IllegalStateException
- 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
-
getQueueSize
public int getQueueSize()
- Overrides:
getQueueSizein 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
public Thread newThread(Runnable runnable)
- Specified by:
newThreadin interfaceThreadFactory- Overrides:
newThreadin classorg.springframework.scheduling.concurrent.CustomizableThreadFactory
-
getThreadNamePrefix
public String getThreadNamePrefix()
- Overrides:
getThreadNamePrefixin classorg.springframework.util.CustomizableThreadCreator
-
setThreadNamePrefix
public void setThreadNamePrefix(String threadNamePrefix)
- 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
public void setThreadGroupName(String name)
- Overrides:
setThreadGroupNamein classorg.springframework.util.CustomizableThreadCreator
-
getThreadGroup
public ThreadGroup getThreadGroup()
- Overrides:
getThreadGroupin classorg.springframework.util.CustomizableThreadCreator
-
setThreadGroup
public void setThreadGroup(ThreadGroup threadGroup)
- Overrides:
setThreadGroupin classorg.springframework.util.CustomizableThreadCreator
-
createThread
public Thread createThread(Runnable runnable)
- 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
-
-