I have come across the shutdown hooks functionality which is invoked when java application is shutdown.
I am using SIGTERM signal to shutdown my java process on a linux Box.
And at the time of shutdown, I want to do some disk I/O (persisting some objects) and closing open file buffer( that can take upto 1min)
Can you advise if shutdown hooks are a safe/reliable mechanism for this use case
If there is some better alternative, please suggest.