From 7f7d663c7d50919d428838e33f7c93061cbd3c0f Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 31 Jan 2003 15:53:04 +0000 Subject: [PATCH] * Made also private instance methods unsynchronized, since the only drawback are concurrent method lookups, which usually happen only at the beginning when the server is started. Later, cached lookups don't have the synchronization penalty. * Commented out all debug code. --- src/FESI/Interpreter/ClassInfo.java | 170 ++++++++++++++-------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/src/FESI/Interpreter/ClassInfo.java b/src/FESI/Interpreter/ClassInfo.java index 8b7704cd..e53eb838 100644 --- a/src/FESI/Interpreter/ClassInfo.java +++ b/src/FESI/Interpreter/ClassInfo.java @@ -74,11 +74,11 @@ public class ClassInfo { * @return the ClassInfo of cls, added to the cache if needed */ private static ClassInfo ensureClassInfo(Class cls) { - boolean debug = ESLoader.isDebugJavaAccess(); + // boolean debug = ESLoader.isDebugJavaAccess(); ClassInfo classInfo = (ClassInfo) allClassInfo.get(cls); if (classInfo == null) { - if (debug) System.out.println("** Class info for class '" + - cls + "' not found in cache, created"); + // if (debug) System.out.println("** Class info for class '" + + // cls + "' not found in cache, created"); classInfo = new ClassInfo(); allClassInfo.put(cls, classInfo); } @@ -109,30 +109,30 @@ public class ClassInfo { * @param cls The class for which we look for the property. * @return The PropertyDescriptor or null if not found or in case of error */ - private synchronized PropertyDescriptor cachedBeanFieldLookup(String propertyName, Class cls) { - boolean debug = ESLoader.isDebugJavaAccess(); + private PropertyDescriptor cachedBeanFieldLookup(String propertyName, Class cls) { + // boolean debug = ESLoader.isDebugJavaAccess(); // Check that there is a bean properties cache, chech if the property was cached if (beanProperties != null) { - if (debug) System.out.println("** Bean properties for class '" + - cls + "' found in cache"); + // if (debug) System.out.println("** Bean properties for class '" + + // cls + "' found in cache"); PropertyDescriptor descriptor = (PropertyDescriptor) beanProperties.get(propertyName); if (descriptor!= null) { - if (debug) System.out.println("** property descriptor '" + propertyName + "' found in cache"); + // if (debug) System.out.println("** property descriptor '" + propertyName + "' found in cache"); return descriptor; } } // Not in cache - if (debug) System.out.println("** No property named '" + - propertyName + "' found in cache, lookup started"); + // if (debug) System.out.println("** No property named '" + + // propertyName + "' found in cache, lookup started"); // Do we have a cached BeanInfo ? create it if no if (beanInfo == null) { try { beanInfo = Introspector.getBeanInfo(cls); } catch (IntrospectionException e) { - if (debug) System.out.println(" ** Error getting beaninfo: " + e); + // if (debug) System.out.println(" ** Error getting beaninfo: " + e); return null; } } @@ -142,7 +142,7 @@ public class ClassInfo { PropertyDescriptor descriptor = null; // none found for (int i=0; i0) { - System.out.println("** Looking in " + interfaces.length + " interfaces"); - } + // if (debug && interfaces.length>0) { + // System.out.println("** Looking in " + interfaces.length + " interfaces"); + // } SEARCHININTERFACE: for (int ix=0; ix0) { - if (debug) System.out.println("** " + nmbMethods + " methods named: '" + functionName + "' + found, add to class cache"); + // if (debug) System.out.println("** " + nmbMethods + " methods named: '" + functionName + "' + found, add to class cache"); methods = new Method[nmbMethods]; methodVector.copyInto(methods); if (publicMethods==null) { @@ -435,7 +435,7 @@ public class ClassInfo { } publicMethods.put(functionName, methods); } else { - if (debug) System.out.println("** No method named '" + functionName + "' found"); + // if (debug) System.out.println("** No method named '" + functionName + "' found"); } return methods; } @@ -468,28 +468,28 @@ public class ClassInfo { * @param cls The class in which the function is defined * @return The list of methods or null in case of error or if none found. */ - private synchronized Method [] cachedBeanMethodLookup(String functionName, Class cls) { - boolean debug = ESLoader.isDebugJavaAccess(); + private Method [] cachedBeanMethodLookup(String functionName, Class cls) { + // boolean debug = ESLoader.isDebugJavaAccess(); if (beanMethods != null) { - if (debug) System.out.println("** Method descriptor for bean '" + - cls + "' found in cache"); + // if (debug) System.out.println("** Method descriptor for bean '" + + // cls + "' found in cache"); Method [] methods = (Method []) beanMethods.get(functionName); if (methods!= null) { - if (debug) System.out.println("** " + methods.length + - " method(s) named '" + functionName + "' found in cache"); + // if (debug) System.out.println("** " + methods.length + + // " method(s) named '" + functionName + "' found in cache"); return methods; } - } + } // Not in cache, find if any matching the same name can be found - if (debug) System.out.println("** No method named '" + - functionName + "' found in bean cache, lookup started"); + // if (debug) System.out.println("** No method named '" + + // functionName + "' found in bean cache, lookup started"); // Do we have a cached BeanInfo ? create it if no if (beanInfo == null) { try { beanInfo = Introspector.getBeanInfo(cls); } catch (IntrospectionException e) { - if (debug) System.out.println(" ** Error getting beaninfo: " + e); + // if (debug) System.out.println(" ** Error getting beaninfo: " + e); return null; } } @@ -498,7 +498,7 @@ public class ClassInfo { Vector methodVector = new Vector(allDescriptors.length); for (int i=0; i0) { - if (debug) System.out.println("** " + nmbMethods + " methods named: '" - + functionName + "' + found, add to bean cache"); + // if (debug) System.out.println("** " + nmbMethods + " methods named: '" + // + functionName + "' + found, add to bean cache"); methods = new Method[nmbMethods]; methodVector.copyInto(methods); if (beanMethods==null) { @@ -556,8 +556,8 @@ public class ClassInfo { } beanMethods.put(functionName, methods); } else { - if (debug) System.out.println("** No bean method named: '" + - functionName + "' + found"); + // if (debug) System.out.println("** No bean method named: '" + + // functionName + "' + found"); } return methods; }