3 Replies Latest reply on Aug 24, 2007 10:24 AM by Adrian Brock

    Caching in BaseClassLoaderDomain.findLoaderInExports

    Ales Justin Master

      Is this intended:

       boolean canCache = true;
       boolean canBlackList = true;
      
       String packageName = ClassLoaderUtils.getResourcePackageName(name);
       List<ClassLoaderInformation> list = classLoadersByPackageName.get(packageName);
       if (trace)
       log.trace(this + " trying to load " + name + " from all exports of package " + packageName + " " + list);
       if (list != null && list.isEmpty() == false)
       {
       for (ClassLoaderInformation info : list)
       {
       BaseDelegateLoader exported = info.getExported();
      
       // See whether the policies allow caching/blacklisting
       BaseClassLoaderPolicy loaderPolicy = exported.getPolicy();
       if (loaderPolicy.isCachable() == false)
       canCache = false;
       if (loaderPolicy.isBlackListable() == false)
       canBlackList = false;
      
       if (exported.getResource(name) != null)
       {
       if (canCache)
       globalClassCache.put(name, exported);
       return exported;
       }
       }
       }
       // Here is not found in the exports so can we blacklist it?
       if (canBlackList)
       globalClassBlackList.add(name);
      


      Since even if the 'exported' is _not_ the one that _has_ the resource, and is not cacheable, it sets the canCache to false, so even if the 'real' exported is cacheable, it won't get cached.

      The same for getResourceFromExports method.