"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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...