Description
Motivated by checkpoint restore (#29921), ThreadPoolTaskExecutor
and ThreadPoolTaskScheduler
would benefit from a SmartLifecycle
implementation which pauses and resumes task execution on stop
and start
, even if no SmartLifecycle
-style auto-startup is needed here. This goes along with graceful shutdown enhancements in 6.1 (#27090, #24497) and can nicely be used on its own as well, either through direct calls on the executor bean or through ConfigurableApplicationContext.start/stop
.
Task submitters may individually stop and restart their operations, so pause/resume behavior at the thread pool level is not strictly necessary for lifecycle alignment. However, independently submitted one-off tasks (@Async
etc) and in particular periodic tasks (@Scheduled
etc) can only really be centrally paused and resumed at the executor/scheduler level.