[ 
https://issues.apache.org/jira/browse/MYFACES-3022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985548#action_12985548
 ] 

Mark Struberg commented on MYFACES-3022:
----------------------------------------

Hi!

Txs 4 catching this problematic spot. Not sure if we can take the patch 1:1. We 
first need to be sure that this also works in multi-webapp situations (e.g. 
multiple WebApps in an EAR). If so, adding another Map<ClassLoader,Set<String>> 
would help.

> very slow class loading
> -----------------------
>
>                 Key: MYFACES-3022
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3022
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: General
>    Affects Versions: 2.0.3
>         Environment: Geronimo on Linux Gentoo, Windows XP, Windows 7
>            Reporter: Michał Kudła
>
> Very slow classloading
> this patch can load 1000 times faster
> # This patch file was generated by NetBeans IDE
> # Following Index: paths are relative to: 
> /home/m1k0/Projekty/opensource/repos/asf/myfaces/core/tags/myfaces-core-project-2.0.3/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)
> @@ -36,6 +36,7 @@
>  import org.apache.myfaces.shared_impl.util.ClassUtils;
>  import java.nio.ByteBuffer;
>  import java.nio.charset.Charset;
> +import java.util.HashSet;
>  /**
>   * @author Jacob Hookom
>   * @author Roland Huss
> @@ -44,6 +45,7 @@
>   */
>  public final class Classpath
>  {
> +    private static Set _history = new HashSet();
>      private static final Charset UTF8 = Charset.forName("UTF-8");
>      private Classpath()
>      {
> @@ -72,6 +74,13 @@
>          for (Enumeration<URL> urls = loader.getResources(resource); 
> urls.hasMoreElements();)
>          {
>              URL url = urls.nextElement();
> +         String key = url.toString();
> +         if (_history.contains(key)) 
> +         {
> +             continue;
> +         }
> +         _history.add(key);
> +         
>              URLConnection conn = url.openConnection();
>              conn.setUseCaches(false);
>              conn.setDefaultUseCaches(false);

-- 
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