JBossWeb SVN: r2211 - branches/2.1.x/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2013-06-04 08:36:49 -0400 (Tue, 04 Jun 2013)
New Revision: 2211
Modified:
branches/2.1.x/webapps/docs/changelog.xml
Log:
Start 2.1.14.GA
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2013-06-04 11:44:39 UTC (rev 2210)
+++ branches/2.1.x/webapps/docs/changelog.xml 2013-06-04 12:36:49 UTC (rev 2211)
@@ -15,6 +15,9 @@
</properties>
<body>
+<section name="JBoss Web 2.1.14.GA (jfclere)">
+</section>
+
<section name="JBoss Web 2.1.13.GA (jfclere)">
<subsection name="Coyote">
<changelog>
11 years, 7 months
JBossWeb SVN: r2210 - branches/2.1.x/java/javax/el.
by jbossweb-commits@lists.jboss.org
Author: baranowb
Date: 2013-06-04 07:44:39 -0400 (Tue, 04 Jun 2013)
New Revision: 2210
Modified:
branches/2.1.x/java/javax/el/BeanELResolver.java
Log:
JBWEB-263
Modified: branches/2.1.x/java/javax/el/BeanELResolver.java
===================================================================
--- branches/2.1.x/java/javax/el/BeanELResolver.java 2013-06-04 08:26:13 UTC (rev 2209)
+++ branches/2.1.x/java/javax/el/BeanELResolver.java 2013-06-04 11:44:39 UTC (rev 2210)
@@ -31,7 +31,6 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
public class BeanELResolver extends ELResolver {
@@ -57,8 +56,8 @@
private final boolean readOnly;
- private final ConcurrentCache<String, BeanProperties> cache =
- new ConcurrentCache<String, BeanProperties>(CACHE_SIZE);
+ private final static ConcurrentHashMap<Class<?>, BeanProperties> cache =
+ new ConcurrentHashMap<Class<?>, BeanProperties>(CACHE_SIZE);
public BeanELResolver() {
this.readOnly = false;
@@ -291,10 +290,10 @@
Class<?> type = base.getClass();
String prop = property.toString();
- BeanProperties props = this.cache.get(type.getName());
+ BeanProperties props = this.cache.get(type);
if (props == null || type != props.getType()) {
props = new BeanProperties(type);
- this.cache.put(type.getName(), props);
+ this.cache.put(type, props);
}
return props.get(ctx, prop);
@@ -330,39 +329,24 @@
return null;
}
- private final static class ConcurrentCache<K,V> {
-
- private final int size;
- private final Map<K,V> eden;
- private final Map<K,V> longterm;
-
- public ConcurrentCache(int size) {
- this.size = size;
- this.eden = new ConcurrentHashMap<K,V>(size);
- this.longterm = new WeakHashMap<K,V>(size);
- }
-
- public V get(K key) {
- V value = this.eden.get(key);
- if (value == null) {
- synchronized (longterm) {
- value = this.longterm.get(key);
- }
- if (value != null) {
- this.eden.put(key, value);
- }
+ /*
+ * This method is not part of the API, though it can be used (reflectively) by clients of this class to remove entries from
+ * the cache when the beans are being unloaded.
+ *
+ * A note about why WeakHashMap is not used. Measurements has shown that ConcurrentHashMap is much more scalable than
+ * synchronized WeakHashMap. A manual purge seems to be a good compromise.
+ *
+ * @param classloader The classLoader used to load the beans.
+ */
+ private static void purge(final ClassLoader classloader) {
+ //NOTE: concurrent hash map wont throw concurrent mod
+ Iterator<Class<?>> iter = cache.keySet().iterator();
+ while (iter.hasNext()) {
+ Class<?> key = iter.next();
+ BeanProperties bp = cache.get(key);
+ if(bp.getType().getClassLoader().equals(classloader)){
+ iter.remove();
}
- return value;
}
-
- public void put(K key, V value) {
- if (this.eden.size() >= this.size) {
- synchronized (longterm) {
- this.longterm.putAll(this.eden);
- }
- this.eden.clear();
- }
- this.eden.put(key, value);
- }
}
}
11 years, 7 months