kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
Consider this: why should unlock throw RecordNotFoundException because the record was deleted ?
If another thread tries to do anything with the record after it's been deleted, they should immediately throw RecordNotFoundException
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
"I'm not back." - Bill Harding, Twister
If the specified record is already locked by a different client, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked.
"I'm not back." - Bill Harding, Twister
Originally posted by Jim Yingst:
Hmmm, there's also this quote from lock():
A literal reading here suggests that if a record is deleted but not unlocked, any waiting threads will now have to wait forever. :roll: Which seems rather inane. So I guess there's justification for bending the rules of in Sun's instructions somewhere here, and explaining it in your decisions.txt file. All right then, I withdraw my objection to Ken's solution.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
"I'm not back." - Bill Harding, Twister
permaculture is giving a gift to your future self. After reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|