Peter Royal wrote:
> 
> On Thursday, September 26, 2002, at 09:29  AM, Carsten Ziegeler wrote:
> > Example: I have two components, one being ThreadSafe and one Poolable
> > component which is of course not ThreadSafe.
> >
> > Now, the ThreadSafe component looks up the Poolable one, lets say
> > in the compose() method and stores this instance for the whole
> > lifetime.
> >
> > Does this work properly? I would assume that now the Poolable
> > component is used as a ThreadSafe one. Is this right?
> > Or do I oversee something?
> 
> Yes, you are correct. The single Poolable component you got will be 
> used for all calls to the ThreadSafe component.
> 
> For Poolable components, each call to ComponentManager.lookup() will 
> return you a component instance from the pool.
> 
> For the above example, since each call to a ThreadSafe component's 
> methods are generally stateless, you would probably want to lookup() 
> and release() a new Poolable in each method call.

Thanks, I'm glad that I'm not insane or too paranoid, but...the great
thing about Avalon and the lifecycle interfaces is of course that as
a user of the components I don't have to care about wheter a component
is thread safe or not...

So if I write myself a ThreadSafe component I have to take care that
I do a lookup/release each time I use another component because I
never know if that one is ThreadSafe or not. (I there comes the
same answer from Berin. Thanks Berin).

Ok, so this important statemtent should be documented somewhere.

Thanks all, now I can go and check all my ThreadSafe components...

Regards
Carsten

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

Reply via email to