This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Synchronized and exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


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

Synchronized and exceptions

Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 80
    
    1
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: 486
    
    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: 80
    
    1
Good stuff, that's what I thought although I wanted to make sure!

Thanks!

Chris
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Synchronized and exceptions