pramod KARNANI wrote:
When lock /unlock /isLocked methods will throw RecordNotFoundException?
Can anybody will let me know .
Assuming your method signatures without the throws clause are :-
public long lock(long recNo) //return value is cookie
public void unlock(long recNo, long cookie)
public boolean isLocked(long recNo)
then you could throw RecordNotFoundException when the database does not have a record corresponding to recNo.
Joined: May 22, 2007
I created separate class ReservationsManager.java like denny's project to implement lock/unlock/isLock methods .
to throw RecordNotFoundException in lock/unlock/isLock I need to have access of recordNumber HashMap that I have ContractorDataAccess class.
ContractorDataAccess class has HashMap of recordNumber .
public static HashMap<Integer, Long> recordNumbers = new HashMap<Integer, Long>();
where key is record number and value is location in file (database file)
Am I correct ?
Let me know.
Joined: Jun 01, 2005
I do not know Denny's project.
What would you do when recordNumbersHashMap.containsKey(recNo) returns false / recordNumbersHashMap.get(recNo) returns null?