[jdom-interest] Making setMixedContent appear atomic

Rosen, Alex arosen at silverstream.com
Sun Apr 15 16:52:39 PDT 2001

I agree. In general, it seems silly to me to try to do really nice, helpful
things when a programmer error occurs, besides throw an informative exception.
If someone tries to add a JComboBox to a JDOM document, there's no need for us
to go out of our way to make the document still useable after this error. The
programmer will discover the error and fix their code, so any fancy recovery
code we put into JDOM would be a waste, no?


> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Joseph Bowbeer
> Sent: Friday, April 13, 2001 12:20 AM
> To: jdom-interest at jdom.org
> Cc: Jason Hunter
> Subject: [jdom-interest] Making setMixedContent appear atomic
> 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/0
> 05620.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/0
> 05639.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.
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com

More information about the jdom-interest mailing list