• Post Reply Bookmark Topic Watch Topic
  • New Topic

Identify Long running threads  RSS feed

 
Raj Mohan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've a requirement where I need to raise an exception when a thread is running for more than expected time. How to do this?

Thanks,
Raj Mohan
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they're all threads created by your code can you do them via a pool in which case that's a good place to add the timing code ie store that start times and expected execution times and then set up either a background thread to poll them or a timer to execute on the soonest expected completion time.
 
Billy Tsai
Ranch Hand
Posts: 1306
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about using Thread.yeild()?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!