[jboss-user] [JBoss Microcontainer Development] - ClassPoolRepository vs JBossclDelegatingClassPoolRepository

Flavia Rainone do-not-reply at jboss.com
Fri Apr 16 08:54:30 EDT 2010

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

Start a new discussion in JBoss Microcontainer Development at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100416/ab08b615/attachment.html 

More information about the jboss-user mailing list