Invoke a cleanup method for java user thread, when JVM stops the thread
- by user309281
Hi All
I have J2SE application running in linux. I have stop application script in which i am doing kill of the J2SE pid. This J2SE application has 6 infinitely running user threads,which will be polling for some specific records in backend DB.
When this java pid is killed, I need to perform some cleanup operations for each of the long running thread, like connecting to DB and set status of some transactions which are in-progress to empty.
Is there a way to write a method in each of the thread, which will be called when the thread is going to be stopped, by JVM.