Skip to content

Pause/resume capability for ThreadPoolTaskExecutor and ThreadPoolTaskScheduler #30831

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jhoeller opened this issue Jul 7, 2023 · 0 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

jhoeller commented Jul 7, 2023

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant