• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

find out if a Thread is blocked / blocking monitor

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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) ?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at the monitoring and management API.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic