Add support for gracefully shutting down the web server
This commit adds support for gracefully shutting down the embedded web server. When a grace period is configured (server.shutdown.grace-period), upon shutdown, the web server will no longer permit new requests and will wait for up to the grace period for active requests to complete. Closes gh-4657
This commit is contained in:
@@ -2960,6 +2960,26 @@ You can learn more about the resource configuration on the client side in the <<
|
||||
|
||||
|
||||
|
||||
[[boot-features-graceful-shutdown]]
|
||||
== Graceful shutdown
|
||||
Graceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications.
|
||||
When enabled, shutdown of the application will include a grace period of configurable duration.
|
||||
During this grace period, existing requests will be allowed to complete but no new requests will be permitted.
|
||||
The exact way in which new requests are not permitted varies depending on the web server that is being used.
|
||||
Jetty, Reactor Netty, and Tomcat will stop accepting requests at the network layer.
|
||||
Undertow will accept requests but respond immediately with a service unavailable (503) response.
|
||||
|
||||
Graceful shutdown occurs as one of the first steps during application close processing and before any beans have been destroyed.
|
||||
This ensures that the beans are available for use by any processing that occurs while in-flight requests are being allowed to complete.
|
||||
To enable graceful shutdown, configure the configprop:server.shutdown.grace-period[] property, as shown in the following example:
|
||||
|
||||
[source,properties,indent=0,configprops]
|
||||
----
|
||||
server.shutdown.grace-period=30s
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[boot-features-rsocket]]
|
||||
== RSocket
|
||||
https://rsocket.io[RSocket] is a binary protocol for use on byte stream transports.
|
||||
|
||||
Reference in New Issue
Block a user