Classpath - improve speed up to 1000 times
------------------------------------------

                 Key: MYFACES-2833
                 URL: https://issues.apache.org/jira/browse/MYFACES-2833
             Project: MyFaces Core
          Issue Type: Improvement
          Components: General
    Affects Versions: 2.0.1
         Environment: sun-jdk-1.6.0.21, sun-jdk-1.7.0.0-b100, Gentoo Linux, 
Windoxs XP, 7
            Reporter: Michał Kudła


# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: 
/mnt/work/home/m1k0/Projekty/opensource/repos/asf/myfaces/core/branches/2_0_1/impl/src/main/java/org/apache/myfaces/view/facelets/util
# This patch can be applied using context Tools: Patch action on respective 
folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: Classpath.java
--- Classpath.java Base (BASE)
+++ Classpath.java Locally Modified (Based On LOCAL)
@@ -26,6 +26,7 @@
 import java.net.URLConnection;
 import java.net.URLDecoder;
 import java.util.Enumeration;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.jar.JarEntry;
@@ -43,6 +44,9 @@
  */
 public final class Classpath
 {
+    // m1k0 - zabezpieczenie przed pętlą
+    static private Set history = new HashSet();
+
     private Classpath()
     {
     }
@@ -71,6 +75,14 @@
         {
             URL url = urls.nextElement();
             URLConnection conn = url.openConnection();
+            // m1k0 - zabezpieczenie przed pętlą
+                String key = url.toString();
+                if (history.contains(key)) {
+                    System.out.println("url:" + url+" <<<<<<<<<<<<<<<<<<<<<< 
");
+                    continue;
+                }
+                history.add(key);
+            System.out.println(">>>>>>>>>>>>>>>>>>>>> url:" + url);
             conn.setUseCaches(false);
             conn.setDefaultUseCaches(false);
 



This patch showing, that many times Classpath searching in the same place.

After paching, all log was proccessed by grep and wc


m...@laptok ~/Tymczasowy $ grep '>>>>' classloader-build.log | wc -l
72
m...@laptok ~/Tymczasowy $ grep '<<<<' classloader-build.log | wc -l
7200


In geronimo enviroment I have x 1000 times! This causes waiting 10 minuts for 
every deploy with myFaces :(


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to