[Design the new POJO MicroContainer] - Caching in BaseClassLoaderDomain.findLoaderInExports
by alesj
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
18 years, 7 months