long cookie = data.lock(3);
data.delete(3, cookie);
unlock(3, cookie) //Opps, RecordNotFoundException is thrown,Illogical!
//very bad implementation of update
public void update(int recNo, String[] data, long cookie) {
//update the record
unlock(recNo, cookie);//ugly,we may still want to update the same record!
}
I solve this problem automatically unlocking a record when it is deleted; be sure to document your solution.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|