open class ThreadPoolExecutorFactoryBean : ExecutorConfigurationSupport, FactoryBean<ExecutorService>, InitializingBean, DisposableBean
JavaBean that allows for configuring a java.util.concurrent.ThreadPoolExecutor in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity" properties) and exposing it as a bean reference of its native java.util.concurrent.ExecutorService type.
For an alternative, you may set up a ThreadPoolExecutor instance directly using constructor injection, or use a factory method definition that points to the java.util.concurrent.Executors class. This is strongly recommended in particular for common @Bean methods in configuration classes, where this FactoryBean variant would force you to return the FactoryBean type instead of the actual Executor type.
If you need a timing-based java.util.concurrent.ScheduledExecutorService instead, consider ScheduledExecutorFactoryBean.
Author
Juergen Hoeller
Since
3.0
See Also
java.util.concurrent.ExecutorServicejava.util.concurrent.Executorsjava.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutorFactoryBean()
JavaBean that allows for configuring a java.util.concurrent.ThreadPoolExecutor in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity" properties) and exposing it as a bean reference of its native java.util.concurrent.ExecutorService type. For an alternative, you may set up a ThreadPoolExecutor instance directly using constructor injection, or use a factory method definition that points to the java.util.concurrent.Executors class. This is strongly recommended in particular for common If you need a timing-based java.util.concurrent.ScheduledExecutorService instead, consider ScheduledExecutorFactoryBean. |
open fun getObject(): ExecutorService |
|
open fun getObjectType(): Class<out ExecutorService> |
|
open fun isSingleton(): Boolean |
|
open fun setAllowCoreThreadTimeOut(allowCoreThreadTimeOut: Boolean): Unit
Specify whether to allow core threads to time out. This enables dynamic growing and shrinking even in combination with a non-zero queue (since the max pool size will only grow once the queue is full). Default is "false". |
|
open fun setCorePoolSize(corePoolSize: Int): Unit
Set the ThreadPoolExecutor's core pool size. Default is 1. |
|
open fun setExposeUnconfigurableExecutor(exposeUnconfigurableExecutor: Boolean): Unit
Specify whether this FactoryBean should expose an unconfigurable decorator for the created executor. Default is "false", exposing the raw executor as bean reference. Switch this flag to "true" to strictly prevent clients from modifying the executor's configuration. |
|
open fun setKeepAliveSeconds(keepAliveSeconds: Int): Unit
Set the ThreadPoolExecutor's keep-alive seconds. Default is 60. |
|
open fun setMaxPoolSize(maxPoolSize: Int): Unit
Set the ThreadPoolExecutor's maximum pool size. Default is |
|
open fun setQueueCapacity(queueCapacity: Int): Unit
Set the capacity for the ThreadPoolExecutor's BlockingQueue. Default is Any positive value will lead to a LinkedBlockingQueue instance; any other value will lead to a SynchronousQueue instance. |