[jdom-interest] Making setMixedContent appear atomic
jozart at csi.com
Mon Apr 16 21:47:47 PDT 2001
> One thing we're forgetting here is I already implemented
> the "atomic" behavior, before this discussion ensued. It's
> really no less efficient than before, and the code is reasonable.
> The only issue with the impl that makes this debate worthwhile
> is how the "atomic" code might affect subclasses where
> addContent() does something different with parentage.
> My short answer: tell people subclassing Element/Document
> to override setMixedContent(). :-) I suppose if they were
> changing addContent() in such a way that changed
> parentage behavior, they'd probably be overriding it anyway.
Can you point me to the implementation? I can't find it in the archives.
If we can make setMixedContent failure atomic without sacrificing
performance or introducing complexity that will make it harder to subclass,
then I'm all for it.
Otherwise, I don't think we should sacrifice much in an effort to make an
unchecked exception recoverable (in all likelihood, the exception won't even
Simply documenting setMixedContent as a series of separate add operations
that succeed or fail individually is fine by me.
This also makes it clear to subclass authors that they only need to override
the individual add methods and not setMixedContent.
More information about the jdom-interest