Author: mmusaji
Date: 2011-07-20 11:00:36 -0400 (Wed, 20 Jul 2011)
New Revision: 1787
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml
Log:
Fix for [JBPAPP-6794]
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java 2011-07-20
12:29:40 UTC (rev 1786)
+++
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java 2011-07-20
15:00:36 UTC (rev 1787)
@@ -25,6 +25,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
@@ -34,10 +36,28 @@
public class BeanELResolver extends ELResolver {
+ private static final int CACHE_SIZE;
+ private static final String CACHE_SIZE_PROP =
+ "org.apache.el.BeanELResolver.CACHE_SIZE";
+
+ static {
+ if (System.getSecurityManager() == null) {
+ CACHE_SIZE = Integer.parseInt(
+ System.getProperty(CACHE_SIZE_PROP, "1000"));
+ } else {
+ CACHE_SIZE = AccessController.doPrivileged(
+ new PrivilegedAction<Integer>() {
+ public Integer run() {
+ return Integer.valueOf(
+ System.getProperty(CACHE_SIZE_PROP, "1000"));
+ }
+ }).intValue();
+ }
+ }
private final boolean readOnly;
- private final ConcurrentCache<String, BeanProperties> cache = new
ConcurrentCache<String, BeanProperties>(
- 1000);
+ private final ConcurrentCache<String, BeanProperties> cache =
+ new ConcurrentCache<String, BeanProperties>(CACHE_SIZE);
public BeanELResolver() {
this.readOnly = false;
@@ -312,7 +332,9 @@
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);
}
@@ -322,7 +344,9 @@
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);
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java 2011-07-20
12:29:40 UTC (rev 1786)
+++
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java 2011-07-20
15:00:36 UTC (rev 1787)
@@ -1341,6 +1341,9 @@
return;
}
+ if (context == null)
+ return;
+
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
@@ -1410,6 +1413,9 @@
if (name.startsWith("org.apache.tomcat.")) {
coyoteRequest.setAttribute(name, value);
}
+
+ if (context == null)
+ return;
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java 2011-07-20
12:29:40 UTC (rev 1786)
+++
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java 2011-07-20
15:00:36 UTC (rev 1787)
@@ -46,11 +46,11 @@
/**
* @author Jacob Hookom [jacob(a)hookom.net]
- * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author:
remy.maucherat(a)jboss.com $
*/
public final class ExpressionBuilder implements NodeVisitor {
- private static final ConcurrentCache cache = new ConcurrentCache(5000);
+ private static final ConcurrentCache cache = new ConcurrentCache(10000);
private FunctionMapper fnMapper;
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java 2011-07-20
12:29:40 UTC (rev 1786)
+++
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java 2011-07-20
15:00:36 UTC (rev 1787)
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.el.util;
import java.util.Map;
@@ -21,7 +37,9 @@
public V get(K k) {
V v = this.eden.get(k);
if (v == null) {
+ synchronized (longterm) {
v = this.longterm.get(k);
+ }
if (v != null) {
this.eden.put(k, v);
}
@@ -31,7 +49,9 @@
public void put(K k, V v) {
if (this.eden.size() >= size) {
+ synchronized (longterm) {
this.longterm.putAll(this.eden);
+ }
this.eden.clear();
}
this.eden.put(k, v);
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml 2011-07-20
12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml 2011-07-20
15:00:36 UTC (rev 1787)
@@ -12,6 +12,30 @@
</properties>
<body>
+<section name="JBoss Web 2.1.11.GA (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ <jira>148</jira>: Fix possible NPE on request.set/removeAttribute.
(remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ <jboss-jira>JBPAPP-5293</jboss-jira>: ConcurrentModificationException
in HandshakeCompletedNotify-Thread. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <jira>185</jira>: Fix cache thread safety issue for EL expression
builder.
+ Patch submitted by Takayoshi Kimura. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
<section name="JBossWeb 1.0">
<subsection name="General">