user309281
user309281

Reputation: 3055

Java threads stops running suddenly

I have J2SE application running in 1.5 java VM in RHEL OS. One of the task of the application is to create 3 infinitely running user threads, during startup. The purpose is to check for a request of a particular type in backend DB table and do corresponding operations.

As we observed, the long running threads suddenly stops running, but still the application is alive and JVM process can be seen, in ps -ef|grep java

Can someone throw light on why threads which are created to run in infinite loop, stops suddenly? Any ideas on how to detect this issue and possible resolution will be of great help

With Regards, Krishna

Upvotes: 1

Views: 1883

Answers (2)

mgv
mgv

Reputation: 8484

Perhaps you are having unhandled exceptions.

First of all, you should log all your thread activity (you can use log4j to achieve this).

You can also override the uncaughtException method of the ThreadGroup class and create alerts for when a thread dies due to an exception that has not been caught.

Upvotes: 3

Brian Agnew
Brian Agnew

Reputation: 272237

I would suggest sending a Ctrl+Break to your app, dumping the threads and analysing the output. Perhaps your threads are waiting for some input (IO). Perhaps they're deadlocked. Perhaps they've exited with an uncaught exception. The thread dump will tell you what's going on (and it helps if you name your threads in advance so you can identify them in the dump).

Upvotes: 6

Related Questions