This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
// Locks a record so that it can only be updated or deleted by this client. // Returned value is a cookie that must be used when the record is unlocked, // updated, or deleted. If the specified record is already locked by a // different // client, the current thread gives up the CPU and consumes no CPU cycles // until the record is unlocked.
public long lockRecord(long recNo) throws RecordNotFoundException;
// Releases the lock on a record. Cookie must be the cookie // returned when the record was locked; otherwise throws SecurityException.
questions. 1.Returned value is a cookie that must be used when the record is unlocked
(does this cookie must be the recNo ?)
2.If the specified record is already locked by a different client, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked.
(does the above mean that when current client tries to update a record which is updating by another client. the current client does not allow to do so or the current client has to wait until the lock is released.)