Invoke a cleanup method for java user thread, when JVM stops the thread

Posted by user309281 on Stack Overflow See other posts from Stack Overflow or by user309281
Published on 2010-05-08T06:31:50Z Indexed on 2010/05/08 6:38 UTC
Read the original article Hit count: 284

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about thread