This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Let's say that I have a single instance of an object, and several references to that object. If I create a synchronized block that synchronizes on one of the object references, is access to the object instance synchronized, or is access to only the reference synchronized? ...Mike Broadbear
Mike Broadbear
Ranch Hand
Joined: Jan 14, 2002
Posts: 39
posted
0
Sorry for posting under 'broadbear'. Is there any way that account could be deleted?
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
Done. As for your question - you're really synchronizing on the object, not the reference. Multiple references to the same object are treated equally - the first to attempt to acquire a lock will get it, and the rest will wait.
"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.