aspose file tools*
The moose likes Websphere and the fly likes Thread keeps running even application is down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Thread keeps running even application is down" Watch "Thread keeps running even application is down" New topic
Author

Thread keeps running even application is down

Pranav Bhatt
Ranch Hand

Joined: Mar 20, 2006
Posts: 284
Hi,

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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
Pranav Bhatt
Ranch Hand

Joined: Mar 20, 2006
Posts: 284
Thanks Ulf.
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread keeps running even application is down
 
Similar Threads
3 questions regarding JPanel.
Threads not dieing when program is stopped
daemon threads
How to Identify WorkManager Type for a specific request
daemon Vs User Thread