Cleaning and closing resources on shutdown

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Cleaning and closing resources on shutdown

uris77
Is there a way to hook into a 'shutdown' event so I can close any open connections to a database that the app might have opened?
rus
Reply | Threaded
Open this post in threaded view
|

Re: Cleaning and closing resources on shutdown

rus
Reply | Threaded
Open this post in threaded view
|

Re: Cleaning and closing resources on shutdown

Luke Daley
Administrator
As Rus pointed out, this is something we are still yet to do. I’m looking to gather some more use cases first.

What’s the situation you need this for at the moment?
Reply | Threaded
Open this post in threaded view
|

Re: Cleaning and closing resources on shutdown

uris77
I'm working on a poc to migrate a big grails monolith to smaller apps. One of the issues we had with the grails app was that the java mongo driver is buggy and doesn't close all the connections in its pool properly. So trying to anticipate a question related to that if I get this demo off the ground to show to my coworkers the concept I have in mind.
Reply | Threaded
Open this post in threaded view
|

Re: Cleaning and closing resources on shutdown

Luke Daley
Administrator
Alright, I’ll give it some thought and try and get something in soon.
Reply | Threaded
Open this post in threaded view
|

Re: Cleaning and closing resources on shutdown

uris77
No worries. Everything seems to be closing down okay in my elasticsearch demo. The elasticsearch server logs when the ratpack app shutsdown. I'll monitor mongo's connections, but I suspect the same thing happens there.