[jboss-cvs] JBossAS SVN: r95648 - in projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5: jbosscl and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 27 23:02:03 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-10-27 23:02:03 -0400 (Tue, 27 Oct 2009)
New Revision: 95648
Modified:
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/RegisterModuleCallback.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClDelegatingClassPoolFactory.java
Log:
[JBREFLECT-65] Temporary hack (to be removed in a few hours)
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/RegisterModuleCallback.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/RegisterModuleCallback.java 2009-10-28 03:00:41 UTC (rev 95647)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/RegisterModuleCallback.java 2009-10-28 03:02:03 UTC (rev 95648)
@@ -21,9 +21,12 @@
*/
package org.jboss.classpool.plugins.as5;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.jboss.classloading.spi.dependency.ClassLoading;
@@ -41,6 +44,9 @@
*/
public class RegisterModuleCallback implements ModuleRegistry
{
+ // TODO JBREFLECT-65 Remove ugly hack
+ public static Map<String, WeakReference<ClassLoader>> CLASSLOADERS = new HashMap<String, WeakReference<ClassLoader>>();
+
Logger logger = Logger.getLogger(this.getClass());
private Set<Module> registeredModules = new HashSet<Module>();
@@ -69,6 +75,9 @@
public synchronized void registerModule(Module module)
{
logger.debug("Registering module " + module);
+ // TODO JBREFLECT-65 Remove ugly hack
+ ClassLoader classLoader = ClassLoading.getClassLoaderForModule(module);
+ CLASSLOADERS.put(classLoader.toString(), new WeakReference<ClassLoader>(classLoader));
registeredModules.add(module);
unregisteredModules.remove(module);
}
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClDelegatingClassPoolFactory.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClDelegatingClassPoolFactory.java 2009-10-28 03:00:41 UTC (rev 95647)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClDelegatingClassPoolFactory.java 2009-10-28 03:02:03 UTC (rev 95648)
@@ -29,6 +29,7 @@
import javassist.scopedpool.ScopedClassPoolFactory;
import javassist.scopedpool.ScopedClassPoolRepository;
+import org.jboss.classloader.plugins.loader.ClassLoaderToLoaderAdapter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloading.spi.RealClassLoader;
@@ -119,7 +120,24 @@
parentPoolDomain = new ClassPoolToClassPoolDomainAdapter(parentUnitPool);
}
}
- poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPoolDomain, domain.getParentPolicy(), registry);
+ if (domain.getParent() instanceof ClassLoaderToLoaderAdapter)
+ {
+ // JBREFLECT-65 fix hack
+ try
+ {
+ ClassLoader loader = RegisterModuleCallback.CLASSLOADERS.get(domain.getParent().toString()).get();
+ ClassPool parentPool = ClassPoolRepository.getInstance().registerClassLoader(loader);
+ poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPool, domain.getParentPolicy(), registry);
+ }
+ catch(NullPointerException npe)
+ {
+ poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPoolDomain, domain.getParentPolicy(), registry);
+ }
+ }
+ else
+ {
+ poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPoolDomain, domain.getParentPolicy(), registry);
+ }
ClassPoolDomainRegistry.getInstance().addClassPoolDomain(domain, poolDomain);
}
@@ -174,4 +192,4 @@
}
});
}
-}
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list