Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Thread keeps running even application is down

 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pranav Bhatt
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
    Bookmark Topic Watch Topic
  • New Topic