This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Server side locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Server side locking" Watch "Server side locking" New topic
Author

Server side locking

David Sham
Ranch Hand

Joined: Apr 19, 2005
Posts: 61
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

Joined: Feb 16, 2005
Posts: 147
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


"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Kay Ra
Ranch Hand

Joined: May 03, 2005
Posts: 80
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server side locking
 
Similar Threads
Doubts reagarding database operations for Bodgitt and Scarper
lock and unlock
dealing with lock lost - URLyBird
NX:Client crashed cause deadlock in LockManager
What will the client side lock() method do?