Originally posted by CN John:
I am a bit confused here. Once you lock the record you are making available true. In the while test in lockRecNo you test if available is false. I am not sure if it works as locking because if one thread locks the record and make available true, the next thread checks fails while condition and again locks the record which is not what we want. The test in while in lockRecNo should be complementary to what is now.
I did'nt understand rest of code and so cannot comment on it. Maybe someother can help. You can check locking code in Max Habibi's book which gives a perfect idea of how locking works. You can build on it or can stick with it.
Originally posted by Julian Kennedy:
Do we know if locking at the database level (e.g. a whole Map), as opposed to the record level, is sufficient (if implemented correctly) to score full marks for the locking component? It strikes me as a bit of a weak solution, effectively preventing concurrent writes to the DB. Of course, if it wins full credit, it's a simpler solution than record locking...
Originally posted by Satish Avadhanam:
I see that you are calling notifyAll() after doing a lock. You may want to think about using notifyAll() in lock method and how useful it is.
Originally posted by Anton Golovin:
I think it's pretty useful. But I'd like some advice, if you have a minute to share your opinion. Always interested in other, more experienced developers' opinion.
[ August 03, 2004: Message edited by: Anton Golovin ]