This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git


The following commit(s) were added to refs/heads/master by this push:
     new 32862268 Make MethodUtils CACHE_ENABLED volatile (#414)
32862268 is described below

commit 328622688c12dccc9ff75bb32693a553f51262c2
Author: Naveed Khan <[email protected]>
AuthorDate: Mon Jul 13 14:19:03 2026 +0000

    Make MethodUtils CACHE_ENABLED volatile (#414)
    
    written under the class monitor but read lock-free in computeIfAbsent, so 
setCacheMethods(false) may not be visible to other threads
---
 src/main/java/org/apache/commons/beanutils2/MethodUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/beanutils2/MethodUtils.java 
b/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
index b2b0fecf..10ab531f 100644
--- a/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
+++ b/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
@@ -118,7 +118,7 @@ public final class MethodUtils {
      * would mean having a map keyed by context classloader which may 
introduce memory-leak problems.
      * </p>
      */
-    private static boolean CACHE_ENABLED = true; //NOPMD @GuardedBy("this")
+    private static volatile boolean CACHE_ENABLED = true; //NOPMD volatile: 
written under the class monitor, read lock-free in computeIfAbsent
 
     /**
      * Stores a cache of MethodKey -> Method.

Reply via email to