This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Deadlock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Deadlock" Watch "Deadlock" New topic


Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 235

Hi all,
I am a bit confused about following code's output.

Why a deadlock is not happening,because the main method has locked td and hence after td.start(),the run method should have a lock on td.But the point is that does the run method ever has a lock on td,or is it the XMap object?

Please clarify...

Ankit Garg

Joined: Aug 03, 2008
Posts: 9404

You are right, the run method obtains the lock on the XMap object not the Thread object...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Deadlock
jQuery in Action, 3rd edition