You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Simon Kitching <sk...@apache.org> on 2006/07/02 23:48:16 UTC
Re: [digester] how to make digester thread safe ?
On Tue, 2006-06-27 at 17:26 +0200, Nicolas De Loof wrote:
> Hello guys,
>
> My app recieves an XML doc that is parsed using commons-digester. As a
> digester instance is not thread-safe, I have to build a new digester on
> every incoming request based on my rules file.
> Is there a way to create a "template" digester from rules and to "clone"
> for a specific thread, to avoid parsing the rules on each request ?
> Or is it better to use a digester pool ?
A pool of Digester instances isn't a good idea. Digester instances
aren't "reusable" as described in the documentation; see also the FAQ
entry about reusing instances:
http://wiki.apache.org/jakarta-commons/Digester/FAQ
And unfortunately I don't know of any way to cache the set of rules
generated from an xmlrules file. You can certainly read the xmlrules
file into memory as a string, and wrap that in an InputSource so that
the xmlrules parsing at least doesn't have to do file I/O. However
beyond that I don't know of any performance optimisations available.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org