[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] jmx/src/main/org/jboss/mx/loading UnifiedClassLoader.java
From:       Bill Burke <patriot1burke () users ! sourceforge ! net>
Date:       2003-03-31 21:36:25
[Download RAW message or body]

  User: patriot1burke
  Date: 03/03/31 13:36:23

  Modified:    src/main/org/jboss/mx/loading UnifiedClassLoader.java
  Log:
  cache unfound resources in getResourceLocally.  AOP needed this optimization
  because it checks to see if the UCL actually has the class in its JAR before
  doing class instrumentation
  
  Revision  Changes    Path
  1.20      +17 -2     jmx/src/main/org/jboss/mx/loading/UnifiedClassLoader.java
  
  Index: UnifiedClassLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/loading/UnifiedClassLoader.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- UnifiedClassLoader.java	31 Mar 2003 21:16:26 -0000	1.19
  +++ UnifiedClassLoader.java	31 Mar 2003 21:36:22 -0000	1.20
  @@ -23,6 +23,7 @@
   import org.jboss.mx.logging.SystemLogger;
   
   import java.util.HashMap;
  +import java.util.HashSet;
   import java.io.FileOutputStream;
   import java.io.File;
   
  @@ -43,7 +44,7 @@
   * @author <a href="scott.stark@jboss.org">Scott Stark</a>
   * @author <a href="juha@jboss.org">Juha Lindfors</a>
   * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
  -* @version <tt>$Revision: 1.19 $</tt>
  +* @version <tt>$Revision: 1.20 $</tt>
   */
   public class UnifiedClassLoader
      extends URLClassLoader
  @@ -67,6 +68,11 @@
      protected HashMap resourceMap = new HashMap();
   
      /**
  +    * Keep a set of unfound local resources.  This helps speed up AOP
  +    */
  +   protected HashSet unfoundResources = new HashSet();
  +
  +   /**
       *  Used for dynamically created classes (see loadClass(string, byte[]))
       */
      protected File tempdir = null;
  @@ -205,6 +211,7 @@
         {
            log.debug("Added url: "+url+", to ucl: "+this);
            super.addURL(url);
  +         unfoundResources.clear();
         }
         else if( log.isTraceEnabled() )
         {
  @@ -318,11 +325,19 @@
      */
      public URL getResourceLocally(String name)
      {
  +      if (unfoundResources.contains(name)) return null;
         URL resURL = (URL)resourceMap.get(name);
         if (resURL == null)
         {
            resURL = super.getResource(name);
  -         resourceMap.put(name, resURL);
  +         if (resURL != null)
  +         {
  +            resourceMap.put(name, resURL);
  +         }
  +         else
  +         {
  +            unfoundResources.add(name);
  +         }
         }
         if( log.isTraceEnabled() == true )
            log.trace("getResourceLocally("+this+"), name="+name+", resURL:"+resURL);
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic