Description
Kenny MacLeod opened SPR-5337 and commented
There is currently a gap in functionality between ThreadPoolTaskExecutor, which is offers lots of ways of configuring a ThreadPoolExecutor but hides it behind a TaskExecutor facade, and SheduledExecutorFactoryBean, which generates a ScheduledThreadPoolExecutor and is a FactoryBean.
It feels like these two should be brought together somehow. I've created a subclass ThreadPoolTaskExecutor which implements FactoryBean and exposes the native ThreadPoolExecutor. I think that SheduledExecutorFactoryBean could itself just be a subclass of ThreadPoolTaskExecutor, but which overrides the method which creates the executor instance.
So, how about a class called ThreadPoolExecutorFactory, which provides facilities for configuring and instantiating ThreadPoolExecutor instances, and then a variety of subclasses of this, including ThreadPoolTaskExecutor (which wraps the ThreadPoolExecutor in a TaskExecutor facade), and ThreadPoolExecutorFactoryBean (which exposes the ThreadPoolExecutor directly). SheduledExecutorFactoryBean would simply become a special case of ThreadPoolExecutorFactoryBean.
Affects: 2.5.6