I have following dilemma for my lock method. Currently I check against a deletedRecords set to make sure the record I am trying to lock was not deleted while waiting for the record number to be gone from my lockedRecords set. Something like this:
As some of you have pointed out on this forum, simply checking if the record has not been deleted is not enough. A RecordNotFoundException should also be thrown by the lock method if the record does not exist. I am using a single RAF instance, not any kind of caching. So, I am thinking the only way to validate if the record to be locked (if not deleted) exists, is doing a physical read on the raf inside the lock method ! I would like to know if this physical read is really necessary or if the check against my deletedRecords set is enough validation for the lock method ?
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5