This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server side locking

 
David Sham
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen a lot of questions concerning the lock mechanism and especially what to do to solve the problem of a client locking a record and then dying before unlocking it. I have not read anything on the forum about using a server-side locking mechanism though.

Why not put all of the lock and unlock functionality within the server? Even though the methods of the assignment interface Sun provides are public, there is no requirement that they must be called from outside of their implementing class. This way, you do not have to worry about what to do if a client dies while locking a record. The server would handle it and complete it's response even if the client dies while the server has the record locked. At the end of the server's response, the server would unlock the record. No need for any timeout mechanisms or otherwise.

This seems much more simple and easier to implement. Any ideas on this, or am I just slow in discovering an already dead horse ? Thanks.
 
Wei-ju Wu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

this topic was subject of long discussions in the past. You might want to have a look on this thread:

Should lock methods be callable by the client

Wei-ju
 
Kay Ra
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually my instruction specifically says no timeouts in the comments preceding the lock signature. My opinion is that the examiner is looking for a practical implementation as opposed to a complex lock strategy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic