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;
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>() {
+
+ @Override
+ 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);
+ new ConcurrentCache<String, BeanProperties>(CACHE_SIZE);
public BeanELResolver() {
this.readOnly = false;
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;
*/
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<Integer>() {
+
+ @Override
+ public Integer run() {
+ return Integer.valueOf(
+ System.getProperty(CACHE_SIZE_PROP, "5000"));
+ }
+ }).intValue();
+ }
+ }
+
private static final ConcurrentCache<String, Node> cache =
- new ConcurrentCache<String, Node>(5000);
+ new ConcurrentCache<String, Node>(CACHE_SIZE);
private FunctionMapper fnMapper;
<code>false</code> will be used.</p>
</property>
+ <property name="org.apache.el.BeanELResolver.CACHE_SIZE">
+ <p>The number of javax.el.BeanELResolver.BeanProperties objects that will
+ be cached by the EL Parser. If not specified, the default of
+ <code>1000</code> will be used.</p>
+ </property>
+
+ <property name="org.apache.el.ExpressionBuilder.CACHE_SIZE">
+ <p>The number of parsed EL expressions that will be cached by the EL
+ Parser. If not specified, the default of <code>5000</code> will be used.
+ </p>
+ </property>
+
</properties>
</section>