File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Synchronized and exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Synchronized and exceptions" Watch "Synchronized and exceptions" New topic
Author

Synchronized and exceptions

Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 71
Hi everyone,

I've been out of the game for a while so wanted to run something by you all. Let's say we have the following code...




..in that instance, what happens to the lock on the object object if a were to equal b?

Thanks,

Chris
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 445
    
    2

The object will be released no matter how it happend...ie by throw exception or by end of execution synchronized block.


Fernando Franzini - Java Blog
Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 71
Good stuff, that's what I thought although I wanted to make sure!

Thanks!

Chris
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Synchronized and exceptions
 
Similar Threads
synchronized question
Synchronized blocks
synchronizing on an arbitrary Class object
Threading from seperate class
About synchoronized code blocks in java