Deadlock Sample Program Java
T1 acquiring lock on java.lang.Object@6d9dd520 t1 acquired lock on java.lang.Object@6d9dd520 t2 acquiring lock on java.lang.Object@22aed3a5 t2 acquired lock on java.lang.Object@22aed3a5 t3 acquiring lock on java.lang.Object@218c2661 t3 acquired lock on java.lang.Object@218c2661 t1 acquiring lock on java.lang.Object@22aed3a5 t2 acquiring lock on java.lang.Object@218c2661 t3 acquiring lock on java.lang.Object@6d9dd520 Here we can clearly identify the deadlock situation from the output but in real life applications it’s very hard to find the deadlock situation and debug them. How to Detect Deadlock in Java To detect a deadlock in java, we need to look at the of the application, in last post I explained how we can generate thread dump using VisualVM profiler or using jstack utility.