I am quite puzzle as to why the given requirement require us to throw RecordNotFoundException in the method lockRecord(long recNo)
I have a hashmap(lockedRecords) which stored the recNo and its matching cookie value.
In the event that a recNo is found in the hashmap, it would mean someone is already using it, and the client wanting to lock the record would need to wait until it is unlocked by the prev client.
In the event that no recNo is found in the lockedRecords, it would mean that the recNo is safe to use for the calling client, and my program would update the hashmap, return the cookie number and notify all.
However, i can't see the occasion where i need to throw a RecordNotFoundException