Skip to content
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

Web Server Graceful Shutdown #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Web Server Graceful Shutdown #40

wants to merge 5 commits into from

Conversation

rscoz
Copy link

@rscoz rscoz commented May 17, 2023

The purpose of this PR is to enable a graceful shutdown for the application and to introduce additional log levels.

You can find more information on this topic at the following link: Spring Boot Web Server Shutdown

Also modify the script to use exec for running the Java application. This approach is particularly useful when utilising Docker/Kubernetes, as it enables signal reception at PID1.

2023-05-17 23:05:00.507 DEBUG 1 --- [ionShutdownHook] o.s.b.a.ApplicationAvailabilityBean      : Application availability state ReadinessState changed from ACCEPTING_TRAFFIC to REFUSING_TRAFFIC
2023-05-17 23:05:00.513 DEBUG 1 --- [ionShutdownHook] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3567135c, started on Wed May 17 23:03:56 UTC 2023
2023-05-17 23:05:00.523  INFO 1 --- [ionShutdownHook] o.s.b.web.embedded.jetty.JettyWebServer  : Commencing graceful shutdown. Waiting for active requests to complete
2023-05-17 23:05:00.527  INFO 1 --- [ jetty-shutdown] o.s.b.web.embedded.jetty.JettyWebServer  : Graceful shutdown complete
2023-05-17 23:05:00.539  INFO 1 --- [ionShutdownHook] o.e.jetty.server.AbstractConnector       : Stopped ServerConnector@38364841{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023-05-17 23:05:00.540  INFO 1 --- [ionShutdownHook] org.eclipse.jetty.server.session         : node0 Stopped scavenging
2023-05-17 23:05:00.541  INFO 1 --- [ionShutdownHook] o.e.j.s.h.ContextHandler.application     : Destroying Spring FrameworkServlet 'dispatcherServlet'
2023-05-17 23:05:00.543  INFO 1 --- [ionShutdownHook] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@37e547da{application,/,[file:///tmp/jetty-docbase.8080.7305229179307511171/],STOPPED}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant