[jdom-interest] Thread questions regarding JDOM SAXBuiler?

David Wall d.wall at computer.org
Mon Aug 30 11:42:39 PDT 2004


The docs clearly say that JDOM is not threaded and that thread safety comes
from our code.  That's fine.

But can anybody tell me if the cost of instantiating a SAXBuilder object is
considered "expensive" or not?  In other words, should I have a pool of
SAXBuilder objects if I plan on doing a lot of XML parsing (which is already
expensive, though most of our docs are quite small -- such as configuration
data) or are these objects lightweight enough to just instantiate, use and
throw away?

Thanks,
David

----- Original Message ----- 
From: "David Wall" <d.wall at computer.org>
To: <jdom-interest at jdom.org>
Sent: Sunday, August 29, 2004 3:32 PM
Subject: [jdom-interest] Thread questions regarding JDOM SAXBuiler?


> If I expect to do a lot of parsing with JDOM, it seems that I might want
to
> create a pool of SAXBuilder objects to avoid the overhead of loading the
> parser.  Is that true, or is the overhead of creating one quite small?
>
> Is a SAXBuilder thread-safe, or should I only be calling the
> SAXBuilder.build() method in a single thread at a time for a given
> SAXBuilder?
>
> And I presume it's okay to reuse a SAXBuilder object by having many
> different threads build() documents over time without any issues that one
> XML parsing would affect the other (assuming they have the same options,
> like ignore whitespace, validation, etc.).
>
> Is that the case?  If I do a lot of parsing (at least once per HTTP
> request), should I use a pool of SAXBuilder objects for this purpose, or
is
> the overhead small enough that I can just create a new SAXBuilder whenever
I
> want one?
>
> Thanks,
> David
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list