• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

lock and RecordNotFoundException  RSS feed

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When lock /unlock /isLocked methods will throw RecordNotFoundException?

Can anybody will let me know .



Thanks
Pramod
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pramod KARNANI wrote:
When lock /unlock /isLocked methods will throw RecordNotFoundException?

Can anybody will let me know .

Thanks
Pramod



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.
 
pramod karnani
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Mahesh Kumaraguru
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know Denny's project.

What would you do when recordNumbersHashMap.containsKey(recNo) returns false / recordNumbersHashMap.get(recNo) returns null?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!