Deadlock occurs when two threads are blocked, with each waiting for the other's lock. Neither can run until the other gives up its lock, so they'll sit there forever.
This can happen, for example, when thread A hits synchronized code, acquires a lock B, and then enters another method (still within the synchronized code it has the lock on) that's also synchronized. But thread A can't get the lock to enter this synchronized code—block C—because another thread D has the loc
Post a Comment