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
Joined: Jan 14, 2002
Sorry for posting under 'broadbear'. Is there any way that account could be deleted?
Joined: Jan 30, 2000
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.