Thanks,<br /> Zafer<br /> SCJP, SCWCD
SCJP 1.4, SCJD
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Thanks,<br /> Zafer<br /> SCJP, SCWCD
Originally posted by Zafer Abu saeed:
Thanks Mike and Andrew,
I don't know how I didn't think about that, this is an essential idea.
Based on this, I will synchronize the {seek, read} operations,
although this will reduce concurrency dramatically, since some methods -
like update()- will synchronize a large block {seek, read, check cookie, write}.?
Originally posted by peter wooster:
Update doesn't need to do {seek, read, check cookie, write}, it can check the cookie without synch since if its locked the record the cookie won't change. It doesn't need to read before write since the record won't have changed since it locked it. So the synch is only needed on {seek, write}.
Thanks,<br /> Zafer<br /> SCJP, SCWCD
Thanks,<br /> Zafer<br /> SCJP, SCWCD
Originally posted by peter wooster:
So the business operation of booking a record is:
{
lockRecord => {wait(lockMap), checkDeleted => synch(raf){seek,read}}
readRecord => synch(raf){seek,read}
check that record is the same as version in table
updateRecord => synch(raf){seek, write}
unlockRecord => {notifyAll(lockMap)}
}
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|