cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <pati_giac...@yahoo.com>
Subject Re: [C2]Advise on pooling
Date Wed, 15 Nov 2000 14:55:08 GMT

--- Lassi Immonen <limmonen@malla.urova.fi> wrote:
> Giacomo Pati wrote:
> > 
> > --- Lassi Immonen <limmonen@malla.urova.fi> wrote:
> > > Hi,
> > >
> > > I would like to implement pooling in Transformer which translates
> > > xml-files from translations file.
> > > Now it loads translations to Map every time request is made but I
> > > would
> > > like to keep available pool of Maps containing translations for a
> > > given
> > > url/language.
> > 
> > I don't know exactly what you mean. If you want to save already
> > processed stuff into a store for later reusage then use the store
> > component (see XalanTransformer.java).
> 
> Well, now my transformer has field "Map dictionary". And I want to
> add
> "Hashtable dictionaries" which is in form (incoming url+lang,
> dictionary) and put loaded dictionaries in there and check if one is
> available before parsing translations file. 

Don't use Hashtables! We are coding against a JDK 1.2 so use HashMaps.

> Do I have to make my transformer poolable or put dictionaries
> Hashtable
> outside transformer to get the available dictionaries every time my
> transformer is called? Is transformer created every time/request or
> does
> it stay in memory? 

No transformer is able to be thread safe because of the SAX model
(except you are using ThreadLocal stuff). So, if you implement Poolable
on your transformer you prevent reinstaciating your transformer over
and over again because the framework will put it into a pool. Use the
store component from the ComponentManager to put your Maps into.

Giacomo


=====


__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

Mime
View raw message