Class 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:
    Serialized Form
    • 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 factory
        delegate - delegate to wrap
        beanName - 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 factory
        delegate - delegate to wrap
        Returns:
        traced instance
      • execute

        public void execute​(Runnable task)
        Specified by:
        execute in interface Executor
        Specified by:
        execute in interface org.springframework.core.task.TaskExecutor
        Overrides:
        execute in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • execute

        public void execute​(Runnable task,
                            long startTimeout)
        Specified by:
        execute in interface org.springframework.core.task.AsyncTaskExecutor
        Overrides:
        execute in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • submit

        public Future<?> submit​(Runnable task)
        Specified by:
        submit in interface org.springframework.core.task.AsyncTaskExecutor
        Overrides:
        submit in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • submit

        public <T> Future<T> submit​(Callable<T> task)
        Specified by:
        submit in interface org.springframework.core.task.AsyncTaskExecutor
        Overrides:
        submit in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • submitListenable

        public org.springframework.util.concurrent.ListenableFuture<?> submitListenable​(Runnable task)
        Specified by:
        submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutor
        Overrides:
        submitListenable in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • submitListenable

        public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable​(Callable<T> task)
        Specified by:
        submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutor
        Overrides:
        submitListenable in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • prefersShortLivedTasks

        public boolean prefersShortLivedTasks()
      • setThreadFactory

        public void setThreadFactory​(ThreadFactory threadFactory)
        Overrides:
        setThreadFactory in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • setRejectedExecutionHandler

        public void setRejectedExecutionHandler​(RejectedExecutionHandler rejectedExecutionHandler)
        Overrides:
        setRejectedExecutionHandler in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • setWaitForTasksToCompleteOnShutdown

        public void setWaitForTasksToCompleteOnShutdown​(boolean waitForJobsToCompleteOnShutdown)
        Overrides:
        setWaitForTasksToCompleteOnShutdown in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • setAwaitTerminationSeconds

        public void setAwaitTerminationSeconds​(int awaitTerminationSeconds)
        Overrides:
        setAwaitTerminationSeconds in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • setBeanName

        public void setBeanName​(String name)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
        Overrides:
        setBeanName in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • getPoolSize

        public int getPoolSize()
        Overrides:
        getPoolSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • getActiveCount

        public int getActiveCount()
        Overrides:
        getActiveCount in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • getQueueCapacity

        public int getQueueCapacity()
        Overrides:
        getQueueCapacity in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • getQueueSize

        public int getQueueSize()
        Overrides:
        getQueueSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Overrides:
        destroy in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • initialize

        public void initialize()
        Overrides:
        initialize in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • shutdown

        public void shutdown()
        Overrides:
        shutdown in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • newThread

        public Thread newThread​(Runnable runnable)
        Specified by:
        newThread in interface ThreadFactory
        Overrides:
        newThread in class org.springframework.scheduling.concurrent.CustomizableThreadFactory
      • getThreadNamePrefix

        public String getThreadNamePrefix()
        Overrides:
        getThreadNamePrefix in class org.springframework.util.CustomizableThreadCreator
      • setThreadNamePrefix

        public void setThreadNamePrefix​(String threadNamePrefix)
        Overrides:
        setThreadNamePrefix in class org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
      • getThreadPriority

        public int getThreadPriority()
        Overrides:
        getThreadPriority in class org.springframework.util.CustomizableThreadCreator
      • setThreadPriority

        public void setThreadPriority​(int threadPriority)
        Overrides:
        setThreadPriority in class org.springframework.util.CustomizableThreadCreator
      • isDaemon

        public boolean isDaemon()
        Overrides:
        isDaemon in class org.springframework.util.CustomizableThreadCreator
      • setDaemon

        public void setDaemon​(boolean daemon)
        Overrides:
        setDaemon in class org.springframework.util.CustomizableThreadCreator
      • setThreadGroupName

        public void setThreadGroupName​(String name)
        Overrides:
        setThreadGroupName in class org.springframework.util.CustomizableThreadCreator
      • getThreadGroup

        public ThreadGroup getThreadGroup()
        Overrides:
        getThreadGroup in class org.springframework.util.CustomizableThreadCreator
      • setThreadGroup

        public void setThreadGroup​(ThreadGroup threadGroup)
        Overrides:
        setThreadGroup in class org.springframework.util.CustomizableThreadCreator
      • createThread

        public Thread createThread​(Runnable runnable)
        Overrides:
        createThread in class org.springframework.util.CustomizableThreadCreator
      • getCorePoolSize

        public int getCorePoolSize()
        Overrides:
        getCorePoolSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setCorePoolSize

        public void setCorePoolSize​(int corePoolSize)
        Overrides:
        setCorePoolSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • getMaxPoolSize

        public int getMaxPoolSize()
        Overrides:
        getMaxPoolSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setMaxPoolSize

        public void setMaxPoolSize​(int maxPoolSize)
        Overrides:
        setMaxPoolSize in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • getKeepAliveSeconds

        public int getKeepAliveSeconds()
        Overrides:
        getKeepAliveSeconds in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setKeepAliveSeconds

        public void setKeepAliveSeconds​(int keepAliveSeconds)
        Overrides:
        setKeepAliveSeconds in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setQueueCapacity

        public void setQueueCapacity​(int queueCapacity)
        Overrides:
        setQueueCapacity in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setAllowCoreThreadTimeOut

        public void setAllowCoreThreadTimeOut​(boolean allowCoreThreadTimeOut)
        Overrides:
        setAllowCoreThreadTimeOut in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
      • setTaskDecorator

        public void setTaskDecorator​(org.springframework.core.task.TaskDecorator taskDecorator)
        Overrides:
        setTaskDecorator in class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor