You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GitBox <gi...@apache.org> on 2020/08/06 11:25:39 UTC
[GitHub] [tomcat] kelthuzadx opened a new pull request #333: Support INDEX.LIST in jar file to speed up resource finding
kelthuzadx opened a new pull request #333:
URL: https://github.com/apache/tomcat/pull/333
`jdk.internal.util.jar.JarIndex` was introduced by JDK1.3, it's an old but useful technique. If third-party JAR files contain INDEX.LIST file(generated via `jar -i` command), these JAR files can be identified as loading into JVM. Class loader such as BuiltinClassLoader,URLClassLoader and subclasses of URLClassLoader can speed up their resource searching with the help of INDEX.LIST since it maps resource names to corresponding JAR names.
The latest version of Tomcat does not aware of `INDEX.LIST`, when there are so many JAR files in `WEB-INF/lib`, Tom cat have to search in all JAR files sequentially, which is obviously slow. This patch helps Tomcat to be aware of `INDEX.LIST`, speeds up the search of resources, especially when there are many JAR files in `WEB-INF/lib`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[GitHub] [tomcat] kelthuzadx closed pull request #333: [Patch] Support INDEX.LIST in jar file to speed up resource finding
Posted by GitBox <gi...@apache.org>.
kelthuzadx closed pull request #333:
URL: https://github.com/apache/tomcat/pull/333
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[GitHub] [tomcat] kelthuzadx commented on pull request #333: [Patch] Support INDEX.LIST in jar file to speed up resource finding
Posted by GitBox <gi...@apache.org>.
kelthuzadx commented on pull request #333:
URL: https://github.com/apache/tomcat/pull/333#issuecomment-674733259
I will fix these problems and give a fresh new patch, anyway, thanks to your review.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[GitHub] [tomcat] markt-asf commented on a change in pull request #333: [Patch] Support INDEX.LIST in jar file to speed up resource finding
Posted by GitBox <gi...@apache.org>.
markt-asf commented on a change in pull request #333:
URL: https://github.com/apache/tomcat/pull/333#discussion_r470802517
##########
File path: java/org/apache/tomcat/util/scan/JarIndex.java
##########
@@ -0,0 +1,61 @@
+package org.apache.tomcat.util.scan;
Review comment:
No ALv2 Header
Why is this class in this package when it is only used in `org.apache.catalina.webresources`?
##########
File path: java/org/apache/catalina/webresources/JarResourceSet.java
##########
@@ -59,6 +63,36 @@ public JarResourceSet(WebResourceRoot root, String webAppMount, String base,
super(root, webAppMount, base, internalPath);
}
+ @Override
+ public WebResource getResource(String path, List<List<WebResourceSet>> allResources) {
+ JarIndex jarIndex = getJarIndex();
+ if(jarIndex==null){
+ return getResource(path);
+ }
+ String webAppMount = getWebAppMount();
+ if (path.startsWith(getWebAppMount())) {
+ String pathInJar = getInternalPath() + path.substring(
+ webAppMount.length());
+ if (pathInJar.length() > 0 && pathInJar.charAt(0) == '/') {
+ pathInJar = pathInJar.substring(1);
+ }
+ List<String> jarFiles = jarIndex.get(pathInJar);
+ if(jarFiles!=null){
Review comment:
Why is this here rather than in `StandardRoot` ?
##########
File path: java/org/apache/catalina/WebResourceSet.java
##########
@@ -36,6 +37,10 @@
*/
WebResource getResource(String path);
+ default WebResource getResource(String path, List<List<WebResourceSet>> allResources){
Review comment:
This looks wrong. A single `WebResourceSet` shouldn't need to be passed a reference to `allResources`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org