Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dead Lock Thread Check

Can somebody tell me how I can find out "how many threads are in deadlock condition" in a Java multi-threading application? What is the way to find out the list of deadlocked threads?

I heard about Thread Dump and Stack Traces, but I don't know how to implement it.

  • I also want to know what new features have been introduced in Java 5 for Threading?

Please let me know with your comments and suggestions.

like image 970
B. S. Rawat Avatar asked Mar 01 '26 10:03

B. S. Rawat


1 Answers

Way of obtaining thread dumps:

  • ctrl-break (Windows) or ctrl-\, possibly ctrl-4 and kill -3 on Linux/UNIX
  • jstack and your process id (use jps)
  • jconsole or visualvm
  • just about any debugger

Major new threading features in J2SE 5.0 (released 2004, in End Of Service Life Period):

  • java.util.concurrent
  • New Java Memory Model.
like image 132
Tom Hawtin - tackline Avatar answered Mar 03 '26 00:03

Tom Hawtin - tackline



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!