[jboss-dev-forums] [Design the new POJO MicroContainer] - Caching in BaseClassLoaderDomain.findLoaderInExports

alesj do-not-reply at jboss.com
Fri Aug 24 07:33:56 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077735#4077735

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077735



More information about the jboss-dev-forums mailing list