You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/09/07 22:07:22 UTC

svn commit: r1166366 - /tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java

Author: markt
Date: Wed Sep  7 20:07:22 2011
New Revision: 1166366

URL: http://svn.apache.org/viewvc?rev=1166366&view=rev
Log:
Reduce cache memory usage for classes with no annotations. Review comment from kkolinko.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java

Modified: tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java?rev=1166366&r1=1166365&r2=1166366&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java Wed Sep  7 20:07:22 2011
@@ -31,6 +31,7 @@ import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -402,6 +403,10 @@ public class DefaultInstanceManager impl
                                 annotation.name()));
                     }
                 }
+                if (annotations.size() == 0) {
+                    // Use common empty list to save memory 
+                    annotations = Collections.emptyList();
+                }
                 annotationCache.put(clazz, annotations);
             } else {
                 for (AnnotationCacheEntry entry : annotations) {



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