tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1166366 - /tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
Date Wed, 07 Sep 2011 20:07:22 GMT
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


Mime
View raw message