I would like to gracefully shut down a SpringBoot application.
The application has multiple ThreadPools and does async processing.
It is connected to the DB and a message bus.
When doing shutdown what I’ve added in the application.yaml or application.properties the configuration:
server.shutdown=graceful
This graceful shutdown feature only applies to Tomcat, Jetty, and Undertow servers.
It should call the destroy()/shutdown()
method on all appropriate beans handled by the Spring context.
Since my application does some processing with JMS-embedded queues I have a custom implementation to check whether all queues are empty before shutting down the application.
It is important to state that the deployment mechanism will remove instances from the balancer before calling the shutdown procedure so that is a safety mechanism for other incoming requests.
Is there something you also check when shutting down the application?
Did you have experience with exceptions with unfinished HTTP or RMI calls while the application was being shut down?
Sorry for the not-so-concrete question, but I would like to hear from experience.
I’ve added all the info I’ve got from current troubleshooting so if it helps someone I’m happy with that also.
Cheers