File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes lock & read or just read? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "lock & read or just read? " Watch "lock & read or just read? " New topic

lock & read or just read?

Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi all,

My assignment has the following comment on the lock(int) method: Locks a record so that it can only be updated or deleted by this client.. So what I am thinking is to only use the physical locking (ie locking on the database file) when reading a record. An additional record locking (along with physical locking) will be only used when updating/deleting a record.

DBClient class

Data class:

Do you think it is an appropriate approach to the read method?

[ December 08, 2005: Message edited by: Alex Sharkoff ]

Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Alex,

I think that is suitable for the read method.

Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
thanks a lot, Andrew.

Consider Paul's rocket mass heater.
subject: lock & read or just read?
It's not a secret anymore!