[JBoss Microcontainer Development] New message: "Re: Modules with null ClassLoaders"
by Kabir Khan
JBoss development,
A new message was posted in the thread "Modules with null ClassLoaders":
http://community.jboss.org/message/524382#524382
Author : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
> mailto:flavia.rainone@jboss.com wrote:
>
> > mailto:flavia.rainone@jboss.com wrote:
> > I'll try skipping the registration of such modules to see if any test breaks. Does anybody has a better idea on how to fix this?
> That didn't break of the tests. Thinking again, it makes a lot of sense to skip the registration of such modules. Given that the newly created class pool will be mapped to a null class loader, it is useless. We are just generating overhead that way.
> Now I wonder which scenarios registerBootstrapLoaders is really needed for.
That was probably just me fumbling in the dark :-) If some of them are not null, the purpose is probably to register those. Or are all of them null? I'm not familiar enough with the classloading/Module stuff to really know why the modules would have null classloaders
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524382#524382
14 years, 3 months
[JBoss Microcontainer Development] New message: "Modules with null ClassLoaders"
by Flavia Rainone
JBoss development,
A new message was posted in the thread "Modules with null ClassLoaders":
http://community.jboss.org/message/524363#524363
Author : Flavia Rainone
Profile : http://community.jboss.org/people/flavia.rainone@jboss.com
Message:
--------------------------------------------------------------
I have just found out that ClassPoolRepository is registering null class loaders.
JBossClDelegatingClassPoolFactory.create method has a call to registerBootstrapClassLoaders
public synchronized AbstractClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
{
if (this.currentClassLoaders.contains(cl))
{
return null;
}
currentClassLoaders.add(cl);
try
{
ClassPool parent = getCreateParentClassPools(cl, src, repository);
if (cl instanceof RealClassLoader)
{
Module module = registry.getModule(cl);
if (module == null)
{
module = getModuleForClassLoader(cl);
}
registerModuleCallback.registerModule(module);
---> registerBootstrapLoaders(module, repository);
...
}
This is the implementation of registerBootstrapLoaders:
private void registerBootstrapLoaders(Module skip, ScopedClassPoolRepository repository)
{
Collection<Module> unregistered = registerModuleCallback.getUnregisteredModules();
if (unregistered.size() > 0)
{
for (Module module : unregistered)
{
if (module == skip)
{
continue;
}
ClassLoader loader = getClassLoaderForModule(module);
if (this.currentClassLoaders.contains(loader))
{
continue;
}
ClassPool classPool = repository.registerClassLoader(loader);
if (classPool == null)
{
repository.unregisterClassLoader(loader);
}
}
}
}
The problem is that many of those modules, if not all, have a null class loader at this point.
I'll try skipping the registration of such modules to see if any test breaks. Does anybody has a better idea on how to fix this?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524363#524363
14 years, 3 months