Re: Question whether a problem with race conditions exists in this
case
On 12/15/11 11:01 PM, Saxo wrote:
Yes, I see. Problem is that there is a list of SwitchableValues
(because several changes were made in the transaction) and they all
need to switch values "in one go" for the commit to be atomic, e.g.
all changes of the transaction become visible at once or not at all.
Have to see whether this can be done with such an
AtomicStampedReference.
Okay, based on your other thread about transactions, I think you're
starting to get a little being the scope of the original question here.
And general advice for transaction management is a little out of my
league. However, if I understood *exactly* your requirements, I might
be able to give specific advice.
The approach you're currently taking can't be fixed to support two
concurrent transactions that may interfere with each-other. You'd have
to have some mechanism to detect a conflict and roll-back or retry in
that case.
Is this purely a learning exercise or are you actually hoping that this
code goes into production somewhere? If it is purely an experiment then
kudos at that, but if not then I suggest escalating the problem to a
more experienced developer. These kinds of things you usually can't
afford to get wrong. unless you have read and fully understood enough
literature on the subject, it is easy to get wrong.
Good luck! This *is* a field I've been interested in, so please keep
following up with your findings!
Thanks,
Daniel.