geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1366408 - /geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Date Fri, 27 Jul 2012 15:06:06 GMT
Author: gawor
Date: Fri Jul 27 15:06:06 2012
New Revision: 1366408

URL: http://svn.apache.org/viewvc?rev=1366408&view=rev
Log:
performance improvment: avoid eager class loading when checking for web services

Modified:
    geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java

Modified: geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=1366408&r1=1366407&r2=1366408&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/server/branches/3.0/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Fri Jul 27 15:06:06 2012
@@ -821,19 +821,19 @@ public class GeronimoStandardContext ext
         if (wrapper.getServlet() == null || webSecurityConstraintStore.isContainerCreatedDynamicServlet(wrapper.getServlet()))
{
             webSecurityConstraintStore.addContainerCreatedDynamicServletEntry(registration,
wrapper.getServletClass());
         }
-        //Special  handle for web service
-        ClassLoader cl = this.getParentClassLoader();
-        Class<?> baseServletClass;
-        Class<?> servletClass;
-        try {
-            baseServletClass = cl.loadClass(Servlet.class.getName());
-            servletClass = cl.loadClass(wrapper.getServletClass());
-            //Check if the servlet is of type Servlet class
-            if (!baseServletClass.isAssignableFrom(servletClass)) {
-                //Nope - its probably a webservice, so lets see...
-                if (webServiceMap != null) {
-                    WebServiceContainer webServiceContainer = webServiceMap.get(wrapper.getName());
-                    if (webServiceContainer != null) {
+        // Special handling for web services
+        if (webServiceMap != null && !webServiceMap.isEmpty()) {
+            WebServiceContainer webServiceContainer = webServiceMap.get(wrapper.getName());
+            if (webServiceContainer != null) {
+                // might be a web service
+                ClassLoader cl = getParentClassLoader();
+                Class<?> baseServletClass;
+                Class<?> servletClass;
+                try {
+                    baseServletClass = cl.loadClass(Servlet.class.getName());
+                    servletClass = cl.loadClass(wrapper.getServletClass());
+                    // ensure the class is NOT a Servlet
+                    if (!baseServletClass.isAssignableFrom(servletClass)) {
                         //Yep its a web service
                         //So swap it out with a POJOWebServiceServlet
                         wrapper.setServletClass("org.apache.geronimo.webservices.POJOWebServiceServlet");
@@ -846,10 +846,10 @@ public class GeronimoStandardContext ext
                         getServletContext().setAttribute(pojoClassID, servletClass);
                         wrapper.addInitParameter(POJOWebServiceServlet.POJO_CLASS, pojoClassID);
                     }
+                } catch (ClassNotFoundException e) {
+                    throw new RuntimeException(e.getMessage(), e);
                 }
             }
-        } catch (ClassNotFoundException e) {
-            throw new RuntimeException(e.getMessage(), e);
         }
         return registration;
     }



Mime
View raw message