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.
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.