spring-framework / org.springframework.scheduling.concurrent / ThreadPoolExecutorFactoryBean / <init>

<init>

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 @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