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>.