File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Deadlock?" Watch "Deadlock?" New topic
Author

Deadlock?

Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
in JLS: It states .... This example would deadlock if a single thread were not permitted to lock a lock more than once.
My question is: When would a single thread NOT BE permitted to lock a lock more than once?? Is there some way to do that in Java??



Thanks,
Shivani


/** Code speaks louder than words */
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Are you paraphrasing? I have no idea what part of the JLS you are referencing.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
This seems to be from JLS 14.19.

[Shivani]: My question is: When would a single thread NOT BE permitted to lock a lock more than once?? Is there some way to do that in Java??

No, there's no way to do this in Java. The JLS was explaining why the decision was made to allow a single thread to hold a lock more than once: in order to avoid automatic deadlock in code such as that quoted above.
[ September 04, 2005: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
Originally posted by Jim Yingst:
This seems to be from JLS 14.19.


Thanks a lot Jim for the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deadlock?