cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: [2.2] ThreadLocal use in PoolableProxyHandler
Date Fri, 03 Jul 2009 15:08:05 GMT
Alexander Daniel wrote
> 
> PoolableFactoryBean [2] creates a new PoolableProxyHandler instance [1]
> for each pooled component used in a pipeline, i.e. it will not be shared
> across different requests. Therefore I do not understand the use of
> ThreadLocal.
Yes, you're right for sitemap components - but this isn't true for any
other component. Imagine a singleton component using a poolable. The
singleton is used by multiple threads and therefore each thread
requires an own instance

Now, this is not optimal and actually it's legacy code - it is only used
for old Avalon components.

Carsten
> 
> Alex
> 
> [1]
>     public Object getObject() throws Exception {
>         return Proxy.newProxyInstance(this.getClass().getClassLoader(),
>                                       this.interfaces,
>                                       new PoolableProxyHandler(this));
>     }
> 
> [2]
> http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/PoolableFactoryBean.java
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

Mime
View raw message