About
deadlock in Java.
The Java programming language neither prevents nor requires detection of deadlock conditions.
Programs where threads hold (directly or indirectly) locks on multiple objects should use conventional techniques for deadlock avoidance, creating higher-level locking primitives that do not deadlock, if necessary.
Articles Related
Example
- Deadlock.java A deadlock causes by interference of a monitor update (I guess)
- SafeLock.java A solution to the Deadlock problem with the implementation of a higher-level lock object
- See also the demo folder in the Jdk demo/management/FullThreadDump or FullThreadDump. Shows how to get thread dumps and look for deadlocks.
Management
Detection
See Thread dump deadlock detection rapport
Minimal Example:
jstack -F PID
Attaching to process ID 24060, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.171-b11
Deadlock Detection:
No deadlocks found.