Flavia Rainone [
http://community.jboss.org/people/flavia.rainone%40jboss.com] created the
discussion
"ClassPoolRepository vs JBossclDelegatingClassPoolRepository"
To view the discussion, visit:
http://community.jboss.org/message/537965#537965
--------------------------------------------------------------
Since we updated the classpool and AOP versions at JBoss AS, we've been seeing some
warning messages showing that unregistering of ClassPool is not working correctly.
The reason for these failures is that AspectManager is using ClassPoolRepository to
register ClassLoaders, whereas the unregistering of ClassLoaders, performed by
RegisterModuleCallback, is using JBossClDelegatingClassPoolRepository. As
JBossClDelegatingClassPoolRepository.registeredModules map lacks the the register info,
unregisterClassLoader is throwing an exception:
public void unregisterClassLoader(ClassLoader classLoader, Module module)
{
ScopedClassPool classPool = registeredModules.remove(module);
if (classLoader == null)
{
if (classPool == null)
{
throw new IllegalStateException("Module " + module + " is not
registered");
}
So, to fix this, AspectManager must start using JBossClDelegatingClassPoolFactory instead
of ClassPoolFactory:
public ClassPool registerClassLoader(ClassLoader ucl)
{
return ClassPoolRepository.getInstance().registerClassLoader(ucl);
}
But this cannot be hard coded because JBossClDelegatingClassPoolFactory provides support
to modules and assumes that you are using jboss-cl, which is only true in AS 5/6
environment. When using JBoss AOP in standalone mode or in JBoss AS 4, we need to use
ClassPoolRepository.
The way that the ClassPool architecture is today, I'll have to make this configurable
on the AOP side (e.g., I'll probably add this to AspectManagerJDK5). Is this the best
option? Or should we rethink ClassPool architecture, making this configurable on the
ClassPool side?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/537965#537965]
Start a new discussion in JBoss Microcontainer Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]