> Usually, in servlets I would create a new serializer everytime to avoid > concurrency problems (reusing a serializer could cause incredible > deadlocks), but maybe the code is so simple that we could reuse() them > (even if I don't count on it). > > Comments on this?
I don't think every serializer can give you reusability. Mine should do that, even though I never tested it. Might require a fix or two. But other serializers might be too complicated to ever be reused. If you know that you are using a certain serializer that is reusable, you can hold a pool of them, then use one from the pool for a given Servlet, put it back in the pool once you're done. Next Servlet comes along, gets a new one or a pooled one. So from a Servlet perspective one serializer/output/format per invocation, from a serializer perspective the serializer is reused over and over. So perhaps (just thinking out loud) a canReuse() method. I just realized that some serializers might need to be destroyed if they are not reused, so we will also need a destroy() method. (Not close(), because close() implies closing the output stream). Having canReuse() and close(), it's possible to create a PoolSerializer that is created and disposed of continueously, but uses a reusable serializer underneath from a pool. > AbstractSerializer? > AbstractMarkupSerializer? Markup! I think BaseMarkupSerializer would indicate the exact purpose of the class. Thanks, you saved the day ;-) arkin > > -- > Stefano Mazzocchi One must still have chaos in oneself to be > able to give birth to a dancing star. > <[EMAIL PROTECTED]> Friedrich Nietzsche -- ____________________________________________________________ Assaf Arkin [EMAIL PROTECTED] CTO http://www.exoffice.com Exoffice, The ExoLab Company tel: (650) 259-9796
