[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: Optimizing Pointcut Matching

flavia.rainone@jboss.com do-not-reply at jboss.com
Mon May 26 13:24:26 EDT 2008


anonymous wrote : It should now be a matter of plugging it into the advisors so we only match what we need to match. 

The BindingClassifier is plugged in the class advisor. However, my initial suggestion was a little different from what we have implemented. My suggestion consisted of keeping pointcuts classified into collections, so that it would be a matter of just retrieving the appropriate collection to perform the matching. Here is a piece of an e-mail I sent to the aop-dev list:

anonymous wrote : So, for example, when ClassAdvisor is building a chain for fieal read, it will do something like AspectManager.getFieldReadPointcuts(), or AspectManager.getPointcuts(PointcutType.FIELD_READ). It would match only those pointcuts to build the chains for field read joinpoints.
  | 
  | To avoid incrementing the AspectManager interface too much, the methods added to AspectManager should be package protected. Another possibility would be adding a single method to AspectManager:
  | PointcutCollection pointcuts = AspectManager.getPointcutCollection();
  | 
  | Whereas PointcutCollection is a package-protected class, and this class would contain the methods to get all the specific pointcuts collection: getExecutionPointcuts, getFieldReadPointcuts, and so on. Notice that, whatever we add to AspectManager, can and should be package-proctected. So, the method above would be package-protected as well.
  | 

This approach would avoid the extra cost of doing an if statement for each binding to be matched. What do you think?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153424#4153424

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153424



More information about the jboss-dev-forums mailing list