On 8 Jun 2004, at 09:31, Simon Kitching wrote:

<snip>

Does anyone remember what the original purpose of the clear method was?
The comment "clear the current contents of the object stack" explains
*what* it is doing, but not why this would be useful.

it's before my time so this would be a good time for craig or scott would need to jump in...


This method is called automatically at the end of parse().

It was present in basically its current form in version 1.1 of this
file, so there's no clues in the CVS log about why it does what it does,
and why it is public.

i've taken a look at the original digester version in cvs and this method is there from the stack. it appears to do exactly what it says on the tin: it cleans the stacks. i'd imagine that this is public since the stacks are not public and there are occasions where it may be useful.


Resetting a Digester instance to a state where it can safely parse
another input document is rather a tricky and fragile thing to do I
believe; I had a go, and didn't feel at all happy about the code that
was necessary so abandoned the attempt and just added the above comment.

that's probably wise (especially since i'd like to cut a 1.6.0 service release very soon). i'm happy that clear does what it should do: it cleans the stacks. i'd probably favour a separate reset() method rather than breaking the contact for clear().


it is possible (in some cases) for a single digester instance to sequentially parse multiple input documents. it's just that the typical use case is to create a new digester instance in each case and so multiple sequential usage has never really been supported.

in terms of http://www.mail-archive.com/[EMAIL PROTECTED]/ msg06390.html, i'm a little sceptical about the performance of pooled digester instances verses creating new instances each time (at least in modern JVMs). depending on the level of concurrency and the number and complexity of the digester rules, the cost of the synchronization required by the pool may outweigh the construction cost. i would be interested to see some actual timings.

anyway, i suspect that it'd be possible to add a reset method that would work for most rulesets (those that clean up after themselves in finish). i'd prefer for any implementation to wait until after the 1.6.0 release branch is taken.

- robert


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to