Therefore myLockedRecords will never be accessed by multiple threads.
Are you sure ? As all your Data instances share a common myLockedRecords structure, the latter will be accessed by multiple client connections, each of them running in its own thread.
Best,
Phil.
"I'm not back." - Bill Harding, Twister
If my connection factory supplies a new Instance ( wrapped of course) of Data how can any other threads access the non static data structures within that instance. I maybe missing something with RMI.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Well apparentally this isn't the case when using RMI.
Though I can't generate a scenario myself where this may happen.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Which implies that all calls to a remote method need to be synchronized even if I'm Sychronizing on the data structure i'm updating within the method.
If I have a remote object(data) that has a 1 - 1 relationship with the client that created it. My instance variable the hold locks for that instance of Data/Client does not need to be a synchronized data structure.
Consider Paul's rocket mass heater. |