Generally, that's what we've been doing in our renderers.

I guess you could also use a ThreadLocal, also, but that's probably
more of a hack than anything else.


On Sat, 12 Feb 2005 14:39:01 -0800, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> On Sat, 12 Feb 2005 16:17:53 -0500, Sean Schofield
> <[EMAIL PROTECTED]> wrote:
> > I was wondering if a renderer needs to be thread safe?  Specifically I
> > was hoping to use a class variable as a "counter" so I could keep
> > track of various counts while I called a certain method recursively.
> >
> 
> Yes, they have to be thread safe ... there's only one instance in
> memory (just like a servlet).
> 
> The best way for a renderer to keep track of stuff like counters would
> be to use one of the generic attributes on the component it is
> rendering.  If you use fully qualified attribute names
> (com.mycompany.foo.COUNTER) you'll avoid collisions with other code
> that is doing the same sort of thing.
> 
> Craig
> 


-- 
-Heath Borders-Wing
[EMAIL PROTECTED]

Reply via email to