-
Notifications
You must be signed in to change notification settings - Fork 40.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate web server graceful shutdown into the application context's lifecycle processing #21325
Comments
This would be great to have. We've currently added this to our applications ourselves by following the approach taken in https://github.com/SchweizerischeBundesbahnen/springboot-graceful-shutdown but it was reasonably invasive (requiring a different application class to 'wrap' the real application). Having proper support would be great! It would be good if command-line applications (e.g. used as cronjobs) can also use the |
At the moment, graceful shutdown is triggered directly by the reactive and servlet application contexts. This works well in isolation but has some drawbacks when other components want to participate in a graceful shutdown. Some of these drawbacks are described by @gnagy in #4657 (comment).
We'd like to explore reworking the management of a
WebServer
's lifecycle and integrating it with the application context's lifecycle processing by implementingSmartLifecycle
. This would make the grace period that's currently configured viaserver.shutdown.grace-period
more general .server.shutdown.grace-period
could be replaced by a new property,spring.lifecycle.timeout-per-shutdown-phase
, that maps onto thetimeoutPerShutdownPhase
property ofDefaultLifecycleProcessor
. We'd then need a new property that can be used to make the web server opt in to graceful shutdown rather than shutting down immediately as it does in 2.2. Something likeserver.shutdown.type
that is a enum withIMMEDIATE
andGRACEFUL
values.The text was updated successfully, but these errors were encountered: