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

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to