commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <>
Subject RE: Digester and Threads Question
Date Wed, 24 Mar 2004 17:27:04 GMT
Or you could just use a pool (Jakarta Commons Pool).  You would have to
implement your own PoolableObjectFactory which basically creates/manages
your Digester instances.

-----Original Message-----
From: Adrian Perez Jorge [] 
Sent: Wednesday, March 24, 2004 12:18 PM
To: Jakarta Commons Users List
Subject: Re: Digester and Threads Question


  What would be the nice way to use a digester per thread?  Suppose the 
number of threads is bounded, so a digester could be created to serve 
each thread. The idea is to have a multiton and get from it the right 
digester for the running thread.

  To build the multiton load once the rules for the digester (well..I 
use xmlrules, so this process is somewhat expensive), then clone the 
digester in a lazy way (i.e. as threads are created).

  Will just a Hashtable do the job where the keys are Threads objects? 
What do you think?


Adrian P.J.

James Carman wrote:

>As long as you use a new Digester each time (like as a local variable
>a method), you'll be fine.  What that means is that you CANNOT use one
>single digester instance in multiple threads at the same time.
>-----Original Message-----
>From: Alan Pocklington [] 
>Sent: Wednesday, March 24, 2004 11:24 AM
>Subject: Digester and Threads Question
>I want to use the Digester in a web application to parse XML documents on 
>the fly.  Basically, the user logs in and his corresponding XML file is 
>loaded from the database, parsed using Digester and displayed to the user 
>for manipulation.
>I'm concerned about the following line in the JavaDoc:
>"A single Digester instance may only be used within the context of a single

>thread at a time, and a call to parse() must be completed before another 
>can be initiated even from the same thread."
>I'm not sure if I fully understand what this is saying. Will this mean I 
>will face problems using the Digester in the above way in a web 
>application?  Is it saying that I can use only one digester instance to 
>service all requests, or will it be okay to put Digester code in my servlet
>which will create a Digester for each request?
>Please help, I'm confused.
>Thanks in advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message