Further improvements to startup performance.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 22 Jun 2011 14:59:11 +0000 (14:59 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 22 Jun 2011 14:59:11 +0000 (14:59 +0000)
Use File URLs where they can be determined for speed.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1138497 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/scan/StandardJarScanner.java
webapps/docs/changelog.xml

index 546b073..4374190 100644 (file)
@@ -155,7 +155,14 @@ public class StandardJarScanner implements JarScanner {
                     }
                     URL url = null;
                     try {
-                        url = context.getResource(path);
+                        // File URLs are always faster to work with so use them
+                        // if available.
+                        String realPath = context.getRealPath(path);
+                        if (realPath == null) {
+                            url = context.getResource(path);
+                        } else {
+                            url = (new File(realPath)).toURI().toURL();
+                        }
                         process(callback, url);
                     } catch (IOException e) {
                         log.warn(sm.getString("jarScan.webinflibFail", url), e);
index af71ac9..572d796 100644 (file)
         <bug>51403</bug>: Avoid NPE in JULI FileHandler if formatter is
         misconfigured. (kkolinko)
       </add>
+      <fix>
+        Previous improvements in JAR scanning performance introduced a start-up
+        performance penalty for some use cases. This fix addresses those
+        performance penalties while retaining the original improvements. (markt) 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">