This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch 1.X
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
The following commit(s) were added to refs/heads/1.X by this push:
new 3e7ebeac Make MethodUtils CACHE_METHODS volatile (1.X) (#416)
3e7ebeac is described below
commit 3e7ebeac2e3710adb0f30a03d264044112a3100a
Author: Naveed Khan <[email protected]>
AuthorDate: Mon Jul 13 22:25:50 2026 +0000
Make MethodUtils CACHE_METHODS volatile (1.X) (#416)
written under the class monitor but read lock-free in getCachedMethod and
cacheMethod, so setCacheMethods(false) may not be visible to other threads
---
src/main/java/org/apache/commons/beanutils/MethodUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/beanutils/MethodUtils.java
b/src/main/java/org/apache/commons/beanutils/MethodUtils.java
index 8d744aa4..8c34acf6 100644
--- a/src/main/java/org/apache/commons/beanutils/MethodUtils.java
+++ b/src/main/java/org/apache/commons/beanutils/MethodUtils.java
@@ -126,7 +126,7 @@ public class MethodUtils {
* which may introduce memory-leak problems.
* </p>
*/
- private static boolean CACHE_METHODS = true;
+ private static volatile boolean CACHE_METHODS = true;
/** An empty class array */
private static final Class<?>[] EMPTY_CLASS_PARAMETERS = new Class[0];