cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [2.2] Proxies for pooled components
Date Mon, 14 Feb 2005 20:12:49 GMT
Carsten Ziegeler wrote:

> Sylvain Wallez wrote:
>> First question, but not the one you expected ;-)
> :( ;)
>> Can you explain what these proxies are for exactly? Is it to avoid 
>> lookup/release at each usage? If yes, how/when are the components 
>> actually put back in the pool (sorry, not much time to look at the 
>> code ATM)?
> Oh, sure, totally forgot about it: yes, the proxies manage the 
> lookup/release. When you look up a pooled component, you get a proxy. 
> The first time, you invoke a method on this proxy, the real component 
> is looked up inside proxy and then used. The component is stored 
> locally in the proxy and the proxy uses a thread local variable. So if 
> different threads use the same proxy, they get different instances. If 
> there were two lookups, two proxies are created and each proxy has its 
> own thread local.

And what if there are several lookups for the same role within the same 
thread? Is the same component used? That may lead to strange behaviours 
with stateful components (and if they are pooled, it's because they are 
stateful), as the state will be shared between the different usage 
locations of the component, which are very likely to not know each other.

This is certainly an interesting feature, but I'm not sure it will be 
usable with that many components.

WDYT? Do you have some uses cases?


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message