Hi Clebert,

Am 15.12.2014 um 19:44 schrieb Clebert Suconic:
> Hello There..
> 
> 
> I'm going to use BeanUtils on ActiveMQ6 to solve properties on my URL parsing:
> 
> 
> I'm setting the BeanUtils instance static on a class.
> 
> and I'm going to eventually use it for setting things on my factory:
> 
> 
> https://gist.github.com/clebertsuconic/be31b2789e7271db002b
> 
> 
> 
> This is a link to my branch:
> https://github.com/clebertsuconic/activemq-6/blob/master-uri/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
> 
> However that's a transient branch, and that's why I added a gist here.
> 
> 
> 
> So, is BeanUtilsBean thread safe? Do I need the synchronized around
> the class? I tried to read the code and I believed it wouldn't be safe
> to do it in multi-thread. (That's probably why you guys use a
> ThreadLocal).  The usage here will be very minimal (at my startup time
> only), so I didn't really mind having the synchronized...   but I
> wanted to double check for correctness..
> 

your interpretation is correct, BeanUtilsBean is not thread-safe. It
uses an instance of PropertyUtilsBean under the hood, which is also not
thread-safe. This object maintains a map to cache the property
descriptors which have already been discovered during bean
introspection. The access to this map is not protected by any means. So
you have to take care for proper synchronization yourself.

Oliver

> 
> 
> also: Why won't you make the FluentIntrospector default on the default
> BeanUtils? it's not 2005 any more :)
> 
> 
> 
> Anyways: I have worked with you guys before here... long time ago:
> https://issues.apache.org/jira/browse/BEANUTILS-291
> 
> 
> It was fun seeing something I did (my collaboration with Niall) almost
> 10 years ago still in place at the current master :)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to