[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Change GeneratedAOPProxyFactory check for whether should cre
kabir.khan@jboss.com
do-not-reply at jboss.com
Thu Apr 3 08:56:32 EDT 2008
>From http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141090#4141090
"kabir.khan at jboss.com" wrote : I could add something to AOP to determine if the instance annotation actually ends up resulting in more aspects (not lifecycle callbacks), and if that is the case return a proxy?
At the moment the GeneratedAOPProxyFactory will create a proxy if there are some introductions or if there are interface introductions, mixins, simplemetadata or instance level metadata
| if (!params.getContainerCache().hasAspects() && !params.getContainerCache().requiresInstanceAdvisor())
| {
| return params.getTarget();
| }
| else
| {
| proxyClass = generateProxy(params);
| }
|
IIRC the reason for this condition was that having an introductions, metadata etc would mean that we could match more pointcuts. However,
at the time this check is done, an instance advisor will have been generated if the condition was met, so I think the check should be changed to only return a proxy if the instance advisor has more aspects than the class advisor? Something like the following (pseudo-code):
| ContainerCache cache = params.getContainerCache();
|
| if (!cache.hasAspects() || (cache.hasAspects() && cache.hasMoreAspectsForInstanceThanInClassContainer()))
| {
| return params.getTarget();
| }
| else
| {
| proxyClass = generateProxy(params);
| }
|
This would mean modifying the aop-mc-int tests under org.jboss.test.microcontainer.matrix.mc.test (and possibly some others)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141314#4141314
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4141314
More information about the jboss-dev-forums
mailing list