commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [digester] how to make digester thread safe ?
Date Sun, 02 Jul 2006 21:48:16 GMT
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


Mime
View raw message