We are using Websphere Work Manager (CommonJ) for spawning threads in our application. We are making use of the default WorkManager and through JNDI accessing it in our application. The code snippet is as below:
We keep running the threads which listens to different queues to check for any message and process it. We do get hung messages as below , came to know this can be configured from admin console to stop showing the warning/error or increase the hung detection time.
Now if we stop the application from admin console, these thread don't get stopped and we keep getting the Hung messages. For another deployment another set of threads adds up to the Hung thread count.
I read somewhere that if we declare thread as Daemon then they get stopped (). So is it fine that we declare the threads as Daemon as below or we need to override the release() method too? Our release() is empty as of now.
How exactly can we stop the application thread from running once the application is stopped? It's an old application using Struts 1.x.
I don't know what the "Websphere Work Manage" is or does, but it if can spawn threads, I would assume that it has facilities for stopping them as needed.
Daemon threads will be stopped before the JVM quits - it doesn't sound like that's the case here.
Joined: Mar 20, 2006
Regarding Daemon thread, i read the posts here. Here it says if yours is a spring app then you somehow have to find your own way to stop threads. As am not using Spring i guess i can override release(). Not sure how exactly it can be done.. may be have to assign null to thread references so they get garbage collected... Actually i was looking out if there is some standard way of doing it..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Thread keeps running even application is down