You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Martin Koci <ma...@gmail.com> on 2011/08/04 22:25:34 UTC

[core] performance: synchronized access for java.beans.PropertyDescriptor.getReadMethod()

Hi,

I'm testing a view where hundreds of concurrent users are expected. I
noticed that  java.beans.PropertyDescriptor.getReadMethod() is
sychronized method and many times are other threads blocked with same
lock (java.beans.PropertyDescriptor instance).  Myfaces use it in
_ComponentAttributesMap:


<BLOCKED> java.beans.PropertyDescriptor.getReadMethod <-
javax.faces.component._ComponentAttributesMap.getComponentProperty(PropertyDescriptor)<-
javax.faces.component._ComponentAttributesMap.get(Object)	

All threads share the same java.beans.PropertyDescriptor instance. 

Very similar problem was reported by a user [1]. For this case, it seems
that weblogic "thinks" that thread is [STUCK] beacuse it was simply
blocked for too long. 

Any ideas hot to improve it? Are Method instances cacheable? For
example, Spring [2] cache them under certain circumstances. I don't know
this low level of reflection well ...
 

Regards,

Kočičák

[1] http://www.mail-archive.com/users@myfaces.apache.org/msg57504.html
[2]
http://javasourcecode.org/html/open-source/spring/spring-3.0.5/org/springframework/beans/CachedIntrospectionResults.java.html


Re: [core] performance: synchronized access for java.beans.PropertyDescriptor.getReadMethod()

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

2011/8/4 Martin Koci <ma...@gmail.com>:
> Hi,
>
> I'm testing a view where hundreds of concurrent users are expected. I
> noticed that  java.beans.PropertyDescriptor.getReadMethod() is
> sychronized method and many times are other threads blocked with same
> lock (java.beans.PropertyDescriptor instance).  Myfaces use it in
> _ComponentAttributesMap:
>
>
> <BLOCKED> java.beans.PropertyDescriptor.getReadMethod <-
> javax.faces.component._ComponentAttributesMap.getComponentProperty(PropertyDescriptor)<-
> javax.faces.component._ComponentAttributesMap.get(Object)
>
> All threads share the same java.beans.PropertyDescriptor instance.
>
> Very similar problem was reported by a user [1]. For this case, it seems
> that weblogic "thinks" that thread is [STUCK] beacuse it was simply
> blocked for too long.
>
> Any ideas hot to improve it? Are Method instances cacheable? For
> example, Spring [2] cache them under certain circumstances. I don't know
> this low level of reflection well ...
>

In theory method instances are cacheable, because once initialized, it
never changes. Maybe we can create a fine wrapper over the real
PropertyDescriptor that cache Method instances or something like that.

regards,

Leonardo Uribe
>
> Regards,
>
> Kočičák
>
> [1] http://www.mail-archive.com/users@myfaces.apache.org/msg57504.html
> [2]
> http://javasourcecode.org/html/open-source/spring/spring-3.0.5/org/springframework/beans/CachedIntrospectionResults.java.html
>
>