[ 
https://issues.apache.org/jira/browse/BEANUTILS-440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13690340#comment-13690340
 ] 

Maurizio Cucchiara commented on BEANUTILS-440:
----------------------------------------------

I don't know if BeanUtils still supports java 1.4, if not, why don't you just 
declare the field as volatile? 
Volatile will enforce the happens-before relationship.
I don't see here the need of extra synchronization and as you know, 
synchronization has a cost.
                
> MethodUtils.CACHE_METHODS is not accessed in a thread-safe way
> --------------------------------------------------------------
>
>                 Key: BEANUTILS-440
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-440
>             Project: Commons BeanUtils
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: BEANUTILS-440.patch
>
>
> MethodUtils.CACHE_METHODS is not accessed in a thread-safe way.
> The field is a mutable static field, but is not volatile (nor Atomic) and 
> only write accesses are synchronised.
> If one thread writes the field, other reader threads may not see the updates 
> immediately (or ever). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to