[Design the new POJO MicroContainer] - Re: Too strict pattern matching in PackageClassFilter
by adrian@jboss.org
"scott.stark(a)jboss.org" wrote : That looks to be by design. We should have a RecursivePackageClassFilter or allow package wildcards like javax.servlet.* to indicate the javax.servlet package or any of its subpackages.
|
Yes. Obviously the semantics of filteredPackages on the WarClassLoaderDeployer
is different to ClassLoadingMetaData's excludedPackages.
i.e. it is recursive rather than an explicit list of packages
anonymous wrote :
| I'll have to look at how the filteredPackages information is incorporated into the class loader model because it could simply be that is where the behavior could be extended.
|
The WarClassLoaderDeployer simply sets the list of explicit packages to exclude.
classLoadingMetaData.setExcludedPackages(filteredPackages);
A simple fix would be to use the option to set the filter directly.
classLoadingMetaData.setExcluded(new RecursivePackageFilter(filteredPackages));
except that no such ClassFilter implementation currently exists.
It should be easy to create one by copying the PackageClassFilter
but change it to use the regular expressions like those in the JavaOnlyClassFilter.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207661#4207661
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207661
15 years, 4 months
[Design the new POJO MicroContainer] - Re: Generated Classes not found if they do not match any of
by adrian@jboss.org
"kabir.khan(a)jboss.com" wrote : so ClassLoaderDomain.clearBlackList() should probably be clear all the domain's classloaders?
|
I'm not sure I understand this. The classloader blacklists only refer to local resources.
After you generate packageA.newClassA against LoaderA, LoaderB still doesn't have
that resource so it can still remember that in its blacklist.
Where I think there might be a problem is if you go through getResourceFromImports()
and related methods because then there is some caching against the ClassLoaderInformation which isn't being cleared by those flush methods.
e.g. something like the following should fix that:
| [ejort@warjort jboss-cl-2.0]$ svn diff --diff-cmd diff -x "-U 10"
| Index: classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoaderDomain.java
| ===================================================================
| --- classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoaderDomain.java (revision 83809)
| +++ classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoaderDomain.java (working copy)
| @@ -84,20 +84,23 @@
|
| /**
| * Flush the internal caches
| */
| public void flushCaches()
| {
| globalClassCache.clear();
| globalClassBlackList.clear();
| globalResourceCache.clear();
| globalResourceBlackList.clear();
| +
| + for (ClassLoaderInformation info : classLoaders)
| + info.flushCaches();
| }
|
| public int getClassBlackListSize()
| {
| return globalClassBlackList.size();
| }
|
| public int getClassCacheSize()
| {
| return globalClassCache.size();
| @@ -1423,13 +1426,18 @@
| protected void clearBlackList(String name)
| {
| if (globalClassBlackList != null)
| {
| globalClassBlackList.remove(name);
| }
| if (globalResourceBlackList != null)
| {
| globalResourceBlackList.remove(name);
| }
| +
| + // Need to clear the import caches as well
| + List<ClassLoaderInformation> infos = classLoaders;
| + for (ClassLoaderInformation info : infos)
| + info.clearBlackList(name);
| }
|
| }
| Index: classloader/src/main/java/org/jboss/classloader/spi/base/ClassLoaderInformation.java
| ===================================================================
| --- classloader/src/main/java/org/jboss/classloader/spi/base/ClassLoaderInformation.java (revision 83809)
| +++ classloader/src/main/java/org/jboss/classloader/spi/base/ClassLoaderInformation.java (working copy)
| @@ -278,16 +278,29 @@
| *
| * @param name the resource name to black list
| */
| public void blackListResource(String name)
| {
| Map<String, String> resourceBlackList = this.resourceBlackList;
| if (resourceBlackList != null)
| resourceBlackList.put(name, name);
| }
|
| + /**
| + * Cleans the entry with the given name from the blackList
| + *
| + * @param name the name of the resource to clear from the blackList
| + */
| + public void clearBlackList(String name)
| + {
| + if (classBlackList != null)
| + classBlackList.remove(name);
| + if (resourceBlackList != null)
| + resourceBlackList.remove(name);
| + }
| +
| @Override
| public String toString()
| {
| return policy.toString();
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207652#4207652
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207652
15 years, 4 months