[jdom-interest] Making setMixedContent appear atomic
philip.nelson at omniresources.com
philip.nelson at omniresources.com
Tue Apr 17 07:08:37 PDT 2001
> That's not enough though. The setMixedContent() call affects
> parentage,
> removing exisitng parents of old content and adding new parents to new
> content. If the above was all that's necessary, writing it atomic
> wouldn't be hard.
your right!
>
> 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.
I'm just getting caught up in my email =8^) You haven't implemented
anything for setAttributes though.
>
> 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.
The performance issue I was thinking of is that on a large document, I would
think you would want to remove the original content as early as possible so
gc could start, possibly before all the new content is added. Yes, your
implementation looks great for the majority of cases.
More information about the jdom-interest
mailing list