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

Sebb commented on BEANUTILS-440:
--------------------------------

This is getting rather off-topic.

{code}
public static void setCacheMethods(boolean cacheMethods) {
    CACHE_METHODS = cacheMethods;
// This is the window I mentioned
// Without sync., another thread can change CACHE_METHODS here
    if (!CACHE_METHODS) {
        clearCache();
    }
}
{code}

As I already wrote, it's not obvious without further investigation whether this 
would cause a problem or not.

If you wish to discuss this further, the Commons Dev mailing list would be more 
suitable; JIRA is not good for discussions and this is getting way off-topic 
for the actual problem.
                
> 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