Author: kkolinko
Date: Fri Sep 12 19:18:22 2014
New Revision: 1624618
URL: http://svn.apache.org/r1624618
Log:
Performance improvement: skip processing early when there are no annotations on
the class.
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624618&r1=1624617&r2=1624618&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12
19:18:22 2014
@@ -1990,10 +1990,9 @@ public class ContextConfig implements Li
return;
}
- String className = clazz.getClassName();
-
AnnotationEntry[] annotationsEntries = clazz.getAnnotationEntries();
if (annotationsEntries != null) {
+ String className = clazz.getClassName();
for (AnnotationEntry ae : annotationsEntries) {
String type = ae.getAnnotationType();
if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
@@ -2066,13 +2065,14 @@ public class ContextConfig implements Li
}
if (handlesTypesAnnotations) {
- for (Map.Entry<Class<?>, Set<ServletContainerInitializer>> entry :
- typeInitializerMap.entrySet()) {
- if (entry.getKey().isAnnotation()) {
- AnnotationEntry[] annotationEntries =
javaClass.getAnnotationEntries();
- if (annotationEntries != null) {
+ AnnotationEntry[] annotationEntries =
javaClass.getAnnotationEntries();
+ if (annotationEntries != null) {
+ for (Map.Entry<Class<?>, Set<ServletContainerInitializer>>
entry :
+ typeInitializerMap.entrySet()) {
+ if (entry.getKey().isAnnotation()) {
+ String entryClassName = entry.getKey().getName();
for (AnnotationEntry annotationEntry :
annotationEntries) {
- if (entry.getKey().getName().equals(
+ if (entryClassName.equals(
getClassName(annotationEntry.getAnnotationType()))) {
if (clazz == null) {
clazz = Introspection.loadClass(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]