Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where to catch ThreadDeath?  RSS feed

 
Jon Wiest
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
Background: I'm maintaining this bloated webapp I inherited. It has an initialization servlet that spawns numerous threads to periodically do batch updates to a database. I'm not allowed to eviscerate this app because "it works", but occasionally one of the threads will die for unknown reasons and the whole thing has to be restarted. There was no logging.
Question: I'm adding log4j and would like to see why and when the thread dies. I'd like to catch (and then rethrow) the ThreadDeath error. Where is the best place to do this? Is it as simple as putting a try-catch block in the run method?
Thanks!
Jon
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be wrong.. but this is the best I can think of..
put the try catch around the run() /start() method invocation.
When thread is interrupted see what happens..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!