[jboss-user] [JBoss AOP Development] New message: "Re: ClassPool Refactoring"

Kabir Khan do-not-reply at jboss.com
Tue Jan 26 10:44:33 EST 2010


User development,

A new message was posted in the thread "ClassPool Refactoring":

http://community.jboss.org/message/522345#522345

Author  : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com

Message:
--------------------------------------------------------------
> mailto:flavia.rainone at jboss.com wrote:
>  
> A quick update on this: for some reason, the behavior of ClassPool.get method is no longer consistent with ScopedClassPool.getLocally method.
Thinking about this, aside from the performance comments, I don't understand why this would happen? The flow should be as mentioned below
> mailto:flavia.rainone at jboss.com wrote:
>  
> The first time AOP asks for a class, during transformation, it knows that the class should be generated by the exact same classpool that corresponds to the classloader that loaded the class, so it uses getLocally.
a) So here the class should be found and added to the classpool's cache in ClassPool.classes
> mailto:flavia.rainone at jboss.com wrote:
>  
> The second time AOP asks for the class is during the same transformation (these are actually indirect calls made from inside javassist, during call weaving, for example), the class is retrieved through get. Currently, the classpool delegates the retrieval of the class to the default domain, and the default domain returns a different class.
b) So it delegates to the domain, which goes over all the classpools in the domain and calls loadLocally() on each class. This hits the cache and if not found there tries to load the class locally. When it comes to the classpool in a) it should be found in its ClassPool.classes.
 
The only scenario I can think of where this might not happen, is if there are two classpools in the domain loading the same class? CP1 was added to the domain first and contains Class A, and CP2 was added later and also contains Class A. If a) happens for Class A using CP2 then that will be added, but in b) when hitting the domain CP1 will be used first. Maybe we are having problems with classpools not getting unregistered as they should?

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/522345#522345




More information about the jboss-user mailing list