I'm developing a project which has complete java code & SQL, where the application kicks-off from the shell script. I want to execute some cleanup task (closing transactions n logging abrupt message) when a user press Ctrl^C.
I tried with adding shut down task by Runtime.getRuntime().addShutdownHook(Thread)
But it'll execute every time my application is exits the VM & i never know is that command killed / executed successfully.
I'm looking for some pointers to implement this.
- Thanks in Advance..!!!