Author: nbelaevski
Date: 2009-10-25 16:17:50 -0400 (Sun, 25 Oct 2009)
New Revision: 15756
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
root/framework/trunk/impl/src/main/java/org/richfaces/util/ReferenceMap.java
Log:
Added synchronization for ReferenceMap and using classes
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java 2009-10-25
19:37:03 UTC (rev 15755)
+++
root/framework/trunk/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java 2009-10-25
20:17:50 UTC (rev 15756)
@@ -24,6 +24,7 @@
import java.beans.BeanInfo;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
+import java.util.Collections;
import java.util.Map;
import javax.faces.context.ExternalContext;
@@ -69,7 +70,7 @@
private GenericsIntrospectionCache(int cacheSize) {
genericsCache = new ReferenceMap<Class<?>, GenericsCacheEntry>(
- new LRUMap<Class<?>, Reference<GenericsCacheEntry>>(cacheSize));
+ Collections.synchronizedMap(new LRUMap<Class<?>,
Reference<GenericsCacheEntry>>(cacheSize)));
}
public GenericsCacheEntry getGenericCacheEntry(Class<?> beanClass) {
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/util/ReferenceMap.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/util/ReferenceMap.java 2009-10-25
19:37:03 UTC (rev 15755)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/util/ReferenceMap.java 2009-10-25
20:17:50 UTC (rev 15756)
@@ -25,6 +25,7 @@
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -55,7 +56,7 @@
}
public ReferenceMap() {
- this(new HashMap<K, Reference<V>>());
+ this(Collections.synchronizedMap(new HashMap<K, Reference<V>>()));
}
public ReferenceMap(Map<K, Reference<V>> map) {
Show replies by date