jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hor...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/support ExpressionEvaluatorManager.java
Date Tue, 11 May 2004 22:52:38 GMT
horwat      2004/05/11 15:52:38

  Modified:    standard/src/org/apache/taglibs/standard/lang/support
                        ExpressionEvaluatorManager.java
  Log:
  Bugzilla #25967
  
  Submitted by Tony Perkins & Richard Kraft
  
  Removed synchronization on getEvaluatorByName() method. Now synchronizing on nameMap and
allowing reads to occur without blocking. Should be a performance improvement.
  
  Revision  Changes    Path
  1.11      +12 -7     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java
  
  Index: ExpressionEvaluatorManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ExpressionEvaluatorManager.java	28 Feb 2004 01:01:44 -0000	1.10
  +++ ExpressionEvaluatorManager.java	11 May 2004 22:52:38 -0000	1.11
  @@ -99,20 +99,25 @@
        * Gets an ExpressionEvaluator from the cache, or seeds the cache
        * if we haven't seen a particular ExpressionEvaluator before.
        */
  -    public static synchronized
  +    public static
   	    ExpressionEvaluator getEvaluatorByName(String name)
               throws JspException {
  -        try {
   
  -            Object oEvaluator = nameMap.get(name);
  -            if (oEvaluator == null) {
  +        Object oEvaluator = nameMap.get(name);
  +        if (oEvaluator != null) {
  +            return ((ExpressionEvaluator) oEvaluator);
  +        }
  +        try {
  +            synchronized (nameMap) {
  +                oEvaluator = nameMap.get(name);
  +                if (oEvaluator != null) {
  +                    return ((ExpressionEvaluator) oEvaluator);
  +                }
                   ExpressionEvaluator e = (ExpressionEvaluator)
                       Class.forName(name).newInstance();
                   nameMap.put(name, e);
                   return (e);
  -            } else
  -                return ((ExpressionEvaluator) oEvaluator);
  -
  +            }
           } catch (ClassCastException ex) {
               // just to display a better error message
               throw new JspException("invalid ExpressionEvaluator: " +
  
  
  

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


Mime
View raw message