This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
I saw some posts about "clientid"'s role.They said that using of clientid can prevent the case as below: A.lock(27) .. B.unlock(27) A.unlock(27) But I doubted it beacase the sequence of execution is lock-reade-modify-unlock.So if Thread A locked one record suceessfully,then Thread B can't locked the same record.Thread B should blocked in lock() method untill Thread A finish unlock() and notifyAll(). Am I wrong? Please tell me why to use clientid?
So if Thread A locked one record suceessfully,then Thread B can't locked the same record.Thread B should blocked in lock() method untill Thread A finish unlock() and notifyAll(). Am I wrong? Please tell me why to use clientid? The problem is not with locking, but with the unlocking. There is an explicit requirement in your instructions (or the javadoc for unlock()) that only the client who locked a particular record can unlock it. The only way to accomplish it is to track the clients. [ June 26, 2003: Message edited by: Eugene Kononov ]