[jdom-interest] Making setMixedContent appear atomic

Joseph Bowbeer jozart at csi.com
Thu Apr 12 21:19:41 PDT 2001


On second thought, I think we're on the wrong track trying to be failure
atomic in what are essentially illegal-argument runtime-exception
situations.  (I'm sorry if my first thought was at all responsible for
getting us on this track in the first place.)

In the case of setMixedContent, I think we're also overlooking the
interaction with subclasses.  Notice that all of the 'add' methods that
setMixedContent calls can be overridden in subclasses.  If, on error, we
want to restore the previous state, we'd need to "replay" all of the old
adds so that the subclasses would have a chance to see them (again).

See:

 http://lists.denveronline.net/lists/jdom-interest/2001-April/005620.html

    "One approach to failure atomicity would be to employ a prepare-commit
protocol, but that's clearly overkill."

 http://lists.denveronline.net/lists/jdom-interest/2001-April/005639.html

    "In the case of setMixedContent, I suggest we view it as a composite of
more primitive operations.  We should strive to make the primitive 'add'
operations failure atomic, but, on failure, we should simply abort
setMixedContent at the point of failure."   And document it.


----- original message -----
From: Jason Hunter jhunter at collab.net
Date: Thu, 12 Apr 2001 20:38:59 -0700

> Well, it turns out that making setMixedContent() appear atomic in
> case of error is in fact harder than expected.






More information about the jdom-interest mailing list