• Post Reply Bookmark Topic Watch Topic
  • New Topic

assumption about lock/unlock

 
Johnva
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am working on the lock/unlock part right now. I made a assumption about the server: there need only one instance of the Data class running on the RMI server (and might be shared by multiple RMI server threads).
Remember the getRecord() and modify() are all synchronized.
So, for getRecord(int recNum), change returned DataInfo object, modify(DatInfo dataInfo) sequence, the race condition can only occur on the concurrent changing DataInfo object part.
If I am right, I am confused why in the requirement it mentiona a lot about lock, read modify, wrtie, unlock sequence?
Any insights are welcome.
Thanks
 
HenkGijsbert
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because multiple clients can connect to that 1 Data class.
I think the famous 'lock/unlock the correct question' mailthread will give you a lot of answers.
Regards,
Henk van Jaarsveld (NL)
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!