Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 24180 invoked from network); 14 Oct 2010 17:38:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Oct 2010 17:38:18 -0000 Received: (qmail 31301 invoked by uid 500); 14 Oct 2010 17:38:17 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 31202 invoked by uid 500); 14 Oct 2010 17:38:17 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 31193 invoked by uid 99); 14 Oct 2010 17:38:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 17:38:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 17:38:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3201323888EC; Thu, 14 Oct 2010 17:37:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1022623 - in /tomcat/trunk: java/javax/el/BeanELResolver.java java/org/apache/el/lang/ExpressionBuilder.java webapps/docs/config/systemprops.xml Date: Thu, 14 Oct 2010 17:37:21 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101014173721.3201323888EC@eris.apache.org> Author: markt Date: Thu Oct 14 17:37:20 2010 New Revision: 1022623 URL: http://svn.apache.org/viewvc?rev=1022623&view=rev Log: Enhance fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=50078 Make cache sizes configurable Modified: tomcat/trunk/java/javax/el/BeanELResolver.java tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java tomcat/trunk/webapps/docs/config/systemprops.xml Modified: tomcat/trunk/java/javax/el/BeanELResolver.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/BeanELResolver.java?rev=1022623&r1=1022622&r2=1022623&view=diff ============================================================================== --- tomcat/trunk/java/javax/el/BeanELResolver.java (original) +++ tomcat/trunk/java/javax/el/BeanELResolver.java Thu Oct 14 17:37:20 2010 @@ -26,6 +26,8 @@ import java.lang.reflect.Array; 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; @@ -35,10 +37,31 @@ import java.util.concurrent.ConcurrentHa 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() { + + @Override + public Integer run() { + return Integer.valueOf( + System.getProperty(CACHE_SIZE_PROP, "1000")); + } + }).intValue(); + } + } + private final boolean readOnly; private final ConcurrentCache cache = - new ConcurrentCache(1000); + new ConcurrentCache(CACHE_SIZE); public BeanELResolver() { this.readOnly = false; Modified: tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java?rev=1022623&r1=1022622&r2=1022623&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java (original) +++ tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java Thu Oct 14 17:37:20 2010 @@ -19,6 +19,8 @@ package org.apache.el.lang; import java.io.StringReader; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.el.ELContext; import javax.el.ELException; @@ -49,8 +51,29 @@ import org.apache.el.util.MessageFactory */ public final class ExpressionBuilder implements NodeVisitor { + private static final int CACHE_SIZE; + private static final String CACHE_SIZE_PROP = + "org.apache.el.ExpressionBuilder.CACHE_SIZE"; + + static { + if (System.getSecurityManager() == null) { + CACHE_SIZE = Integer.parseInt( + System.getProperty(CACHE_SIZE_PROP, "5000")); + } else { + CACHE_SIZE = AccessController.doPrivileged( + new PrivilegedAction() { + + @Override + public Integer run() { + return Integer.valueOf( + System.getProperty(CACHE_SIZE_PROP, "5000")); + } + }).intValue(); + } + } + private static final ConcurrentCache cache = - new ConcurrentCache(5000); + new ConcurrentCache(CACHE_SIZE); private FunctionMapper fnMapper; Modified: tomcat/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1022623&r1=1022622&r2=1022623&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu Oct 14 17:37:20 2010 @@ -80,6 +80,18 @@ false will be used.

+ +

The number of javax.el.BeanELResolver.BeanProperties objects that will + be cached by the EL Parser. If not specified, the default of + 1000 will be used.

+
+ + +

The number of parsed EL expressions that will be cached by the EL + Parser. If not specified, the default of 5000 will be used. +

+
+ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org