top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Deadlock? How to analyze and avoid deadlock situation in java?

0 votes
311 views
What is Deadlock? How to analyze and avoid deadlock situation in java?
posted Feb 12, 2018 by Gn Guruswamy

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Deadlock is a programming situation where two or more threads are blocked forever, this situation arises with at least two threads and two or more resources.

To analyze a deadlock, we need to look at the java thread dump of the application, we need to look out for the threads with state as BLOCKED and then the resources it’s waiting to lock, every resource has a unique ID using which we can find which thread is already holding the lock on the object.

answer Feb 13, 2018 by Frank Lee
...