[jdom-interest] Re: JDOM thread safety
Joseph Bowbeer
jozart at csi.com
Sun Aug 13 14:26:04 PDT 2000
Jason, As I mentioned in private correspondence, I repeat here for
archival and general distribution:
To guarantee thread safety, I recommend that anything that
shouldn't change after construction be declared 'final' and that
anything that can change after construction use 'synchronized' in
some form.
The cached results of lazily evaluated computations would fall
into the latter group, but, as we've discussed, this caching is a
special case because the user isn't aware they're modifying the
document.
As a policy, it seems reasonable to me to decide that the
behind-the-scenes changes should be synchronized by JDOM, and that
synchronization of the other changes should be the responsibility
of the user.
To uphold their end of the bargain, the user can use a read-write
lock. Doug Lea provides several flavors in his util.concurrent
package, including a re-entrant one.
http://gee.cs.oswego.edu/dl/cpj/
By the way, if anyone wants to rock their world concerning thread
safety in Java, look at the "Double-Checked Locking is Broken"
document referenced on Bill Pugh's Java Memory Model page:
http://www.cs.umd.edu/~pugh/java/memoryModel/
--
Joe Bowbeer
--__--__--
Date: Fri, 11 Aug 2000 13:54:27 -0700
From: Jason Hunter <jhunter at acm.org>
To: jdom-interest at jdom.org
Subject: Re: JDOM thread safety
> The point we need to take away is that
> we need to make sure that none of
> our caching logic has race conditions
> for read-only access, and really
> IMHO we *should* guarantee that
> read-only access of JDOM doesn't
> need external synchronization once
> the doc has been built. A quick code
> review of the most likely problem areas
> makes me think we're OK and have
> always been OK, but we need to make
> sure we stay OK in the future.
Received: from latcs2.cs.latrobe.EDU.AU (IDENT:root at latcs2.cs.latrobe.EDU.AU [131.172.42.22])
by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id DAA02030
for <jdom-interest at jdom.org>; Sun, 13 Aug 2000 03:06:57 -0600 (MDT)
From: donaldp at mad.scientist.com
Received: from localhost (pjdonald at localhost)
by latcs2.cs.latrobe.EDU.AU (8.9.3/8.9.3) with ESMTP id TAA19904
for <jdom-interest at jdom.org>; Sun, 13 Aug 2000 19:06:24 +1000
X-Authentication-Warning: latcs2.cs.latrobe.EDU.AU: pjdonald owned process doing -bs
Date: Sun, 13 Aug 2000 19:06:24 +1000 (EST)
X-Sender: pjdonald at latcs2.cs.latrobe.EDU.AU
Reply-To: donaldp at mad.scientist.com
To: jdom-interest at jdom.org
Message-ID: <Pine.LNX.4.21.0008131856591.18657-100000 at latcs2.cs.latrobe.EDU.AU>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: [jdom-interest] SaxBuilder and extra features
Sender: jdom-interest-admin at jdom.org
Errors-To: jdom-interest-admin at jdom.org
X-BeenThere: jdom-interest at jdom.org
X-Mailman-Version: 2.0beta2
Precedence: bulk
List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org>
Hi,
Sorry if this has been mentioned before but I just joined
list. I need to set some custom features and properties on a
SAX parser. SAXBuilder doesn't give you any access to this
as such. Would it be possible to add either methods such as
setFeature( feature, value )
setProperty( property, value )
or else make it extensible via templated method design
pattern ? I would be happy to do it myself if you like ?
Cheers,
Pete
*--------------------------------------------------*
| Latrobe University, | |
| Bundoora, Australia | Does the name 'Pavlov' |
| Office: PW220 | ring a bell ? |
| Ex: 2503 | |
*--------------------------------------------------*
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id UAA02166
for <jdom-interest at jdom.org>; Fri, 11 Aug 2000 20:47:57 -0600 (MDT)
Received: from shorter.eng.sun.com ([129.144.124.35])
by mercury.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id TAA01252;
Fri, 11 Aug 2000 19:47:55 -0700 (PDT)
Received: from eng.sun.com (d-ucup02-124-57 [129.144.124.57])
by shorter.eng.sun.com (8.9.3+Sun/8.9.3/ENSMAIL,v1.7) with ESMTP id TAA13410;
Fri, 11 Aug 2000 19:47:53 -0700 (PDT)
Message-ID: <3994BAC5.415AA299 at eng.sun.com>
Date: Fri, 11 Aug 2000 19:47:33 -0700
From: Edwin Goei <Edwin.Goei at eng.sun.com>
X-Mailer: Mozilla 4.74 [en]C-CCK-MCD {Sony} (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Keith Thomas <K at xol.com>
CC: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Which versions of xerces will JDOM work with
References: <A6A233632DDCD311B2DD00B0D021121652CEBE at xolmail.xtraonline.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: jdom-interest-admin at jdom.org
Errors-To: jdom-interest-admin at jdom.org
X-BeenThere: jdom-interest at jdom.org
X-Mailman-Version: 2.0beta2
Precedence: bulk
List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org>
Keith Thomas wrote:
>
> Hi,
>
> I'm working with a fairly new version of JDOM (a CVS download from last
> week) and can't find details of which version of xerces I should be using. I
> know that a xerces.jar comes with JDOM but I need all the accompanying
> xerces javadocs etc as I sometimes have to work in DOM itself. Apologies if
> this info is somewhere obvious and I've missed it.
You can find Xerces docs at http://xml.apache.org/.
-Edwin
>
> Regards,
> Keith Thomas
> XTRA On-Line
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id UAA02166
for <jdom-interest at jdom.org>; Fri, 11 Aug 2000 20:47:57 -0600 (MDT)
Received: from shorter.eng.sun.com ([129.144.124.35])
by mercury.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id TAA01252;
Fri, 11 Aug 2000 19:47:55 -0700 (PDT)
Received: from eng.sun.com (d-ucup02-124-57 [129.144.124.57])
by shorter.eng.sun.com (8.9.3+Sun/8.9.3/ENSMAIL,v1.7) with ESMTP id TAA13410;
Fri, 11 Aug 2000 19:47:53 -0700 (PDT)
Message-ID: <3994BAC5.415AA299 at eng.sun.com>
Date: Fri, 11 Aug 2000 19:47:33 -0700
From: Edwin Goei <Edwin.Goei at eng.sun.com>
X-Mailer: Mozilla 4.74 [en]C-CCK-MCD {Sony} (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Keith Thomas <K at xol.com>
CC: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Which versions of xerces will JDOM work with
References: <A6A233632DDCD311B2DD00B0D021121652CEBE at xolmail.xtraonline.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: jdom-interest-admin at jdom.org
Errors-To: jdom-interest-admin at jdom.org
X-BeenThere: jdom-interest at jdom.org
X-Mailman-Version: 2.0beta2
Precedence: bulk
List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org>
Keith Thomas wrote:
>
> Hi,
>
> I'm working with a fairly new version of JDOM (a CVS download from last
> week) and can't find details of which version of xerces I should be using. I
> know that a xerces.jar comes with JDOM but I need all the accompanying
> xerces javadocs etc as I sometimes have to work in DOM itself. Apologies if
> this info is somewhere obvious and I've missed it.
You can find Xerces docs at http://xml.apache.org/.
-Edwin
>
> Regards,
> Keith Thomas
> XTRA On-Line
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list