commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r687091 - /commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
Date Tue, 19 Aug 2008 16:50:04 GMT
Author: niallp
Date: Tue Aug 19 09:50:03 2008
New Revision: 687091

URL: http://svn.apache.org/viewvc?rev=687091&view=rev
Log:
BEANUTILS-318 Fix WeakHashMap is not thread safe in MethodUtils using new FastWeakHashMap
- reported by Sylvain Legault

Modified:
    commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java

Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java?rev=687091&r1=687090&r2=687091&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
(original)
+++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
Tue Aug 19 09:50:03 2008
@@ -24,8 +24,6 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
-import java.util.WeakHashMap;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -106,10 +104,14 @@
      * class via different classloaders will generate non-equal MethodDescriptor
      * objects and hence end up with different entries in the map.
      */
-    private static WeakHashMap cache = new WeakHashMap();
+    private static final WeakFastHashMap cache = new WeakFastHashMap();
     
     // --------------------------------------------------------- Public Methods
 
+    static {
+        cache.setFast(true);
+    }
+
     /**
      * Set whether methods should be cached for greater performance or not,
      * default is <code>true</code>.



Mime
View raw message