In the URLyBird project, the requirements specify an interface that includes lock(recNo), unlock(recNo), and isLocked(recNo).
The way I'm implementing things, I don't see why the lock methods are required. Can someone please explain?
First, it looks like only update() and find() are even needed by the application. Obviously these methods are synchronized so that the file pointer is not disturbed while seeking/reading/writing. Now, assuming update() always checks the "owner" field before overwriting, then I've guaranteed not to overbook on top of another reservation. Therefore, why is lock needed? My synchronized methods ensure only one update() runs at a time anyway.
The other problem is that lock() doesn't have a parameter to specify the client requesting the lock. I can't use thead information here because a client can connect to any server thread.
Can someone help me, please?
posted 9 years ago
You are asking for something discussed for million times... Try to search the forum.