Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

find out if a Thread is blocked / blocking monitor

 
Skripi Mayer
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm writing my own Monitor und I'm now implementing JUnit Tests.
Is there any method I can do a test to find out, if a Thread is blocked ?

I found Thread.isAlive(), but it just states the Thread has been started and it is not dead (yet).

I have found 'static java.lang.Thread.holdsLock(Object obj)' but his is just
for the current running Thread...

Is there a way to get some debugging information out of the jvm, to tell me,
which Thread is blocked (where, on what, etc) ?
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the monitoring and management API.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This Java Specialists Newsletter is about automatic detection of deadlocks. The newsletter explores some pretty deep Java stuff some times.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic