ARTICLE AD BOX
Return the ThreadPoolExecutor's core pool size.
The ThreadPoolTaskExecutor documentation starts out by explaining that it is a
JavaBean that allows for configuring a ThreadPoolExecutor in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity" properties) and exposing it as a Spring TaskExecutor. This class is also well suited for management and monitoring (for example, through JMX), providing several useful attributes: "corePoolSize", "maxPoolSize", "keepAliveSeconds" (all supporting updates at runtime); "poolSize", "activeCount" (for introspection only).
The default configuration is a core pool size of 1, with unlimited max pool size and unlimited queue capacity. This is roughly equivalent to Executors.newSingleThreadExecutor(), sharing a single thread for all tasks. Setting "queueCapacity" to 0 mimics Executors.newCachedThreadPool(), with immediate scaling of threads in the pool to a potentially very high number. Consider also setting a "maxPoolSize" at that point, as well as possibly a higher "corePoolSize" (see also the "allowCoreThreadTimeOut" mode of scaling).
The first paragraph stresses that those last two are readonly; you might find them of interest for realtime charting of current load. It also encourages you to take advantage of the flexibility of the ConcurrentTaskExecutor interface.
You supplied no source code. You did not tell us if you used a non-default setAllowCoreThreadTimeOut(true) setting to enable dynamic shrinking of the pool during times of low demand.
If this was an XY question, then ask a brand new question and tell us what your true concerns and goals are.
21.4k5 gold badges29 silver badges52 bronze badges
Explore related questions
See similar questions with these tags.
