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
Just because the method signature in the interface mentions the exception doesn't mean the implementation class must actually throw it. It just means the implementation class CAN throw it.
42
Mike Ngo
Ranch Hand
Joined: Oct 16, 2006
Posts: 89
posted
0
However, i can't see the occasion where i need to throw a RecordNotFoundException
what if the recoNo does not exist in the database file?
henry ang
Greenhorn
Joined: Dec 19, 2006
Posts: 12
posted
0
Thanks Mike..
You are right.. this is the condition which i have missed
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.