users@jersey.java.net

Re: [Jersey] Thread safety of XML-based factories <was> Re: [Jersey] Fixed <was> Re: [Jersey] Jersey vulnerable to XXE attack?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 13 Jul 2009 15:59:54 +0200

On Jul 13, 2009, at 3:15 PM, Martin Probst wrote:

>> Given we are close to releasing i have taken the conservative step of
>> creating and storing factories in thread locals.
>
> Why do you bother with caching them anyways?
>
> If it's for performance reasons, I would suggest to implement the
> simple solution (new factory on every request), then measure, and then
> maybe do something about it. As far as I can see there is nothing
> expensive at least in DocumentBuilderFactory.
>

AFAIK It is the looking up of the implementation that is expensive:

   http://david-buccola.spaces.live.com/blog/cns!9BFFF66C9212158C!500.entry
   http://david-buccola.spaces.live.com/blog/cns!9BFFF66C9212158C!501.entry

Paul.