• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread monitoring

 
vidya mahavadi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am looking at an application which uses ExecutorService which handles 3 threads. These threads handle events put in BlockingQueues one after the other. I need to know when one of these threads fail, I would like to stop the rest of the threads and log the exception.. Can anyone suggest a better mechanism to monitor these threads..

Thanks,
Vidya
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, first define "fails".

If your run() code detects a problem and wants to let somebody know, you can use some kind of pub-sub or callback. Then they should exit run() so the thread can be used for another task.

What other kind of scenario do you want to handle?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!