Skip to content

Commit 3e7ebea

Browse files
authored
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
1 parent a2fbfb6 commit 3e7ebea

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/apache/commons/beanutils/MethodUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public int hashCode() {
126126
* which may introduce memory-leak problems.
127127
* </p>
128128
*/
129-
private static boolean CACHE_METHODS = true;
129+
private static volatile boolean CACHE_METHODS = true;
130130

131131
/** An empty class array */
132132
private static final Class<?>[] EMPTY_CLASS_PARAMETERS = new Class[0];

0 commit comments

Comments
 (0)