[jboss-user] [JBoss AOP] - Re: Tracing/Logging - Actual RMI calls vs calls between EJBs

flavia.rainone do-not-reply at jboss.com
Tue Dec 12 06:56:51 EST 2006


You can write an advice that receives a MethodCalledByMethodInvocation. This way, you can access the caller.

However, this invocation must be used only on advices bound to "call" pointcut expressions.

If you use an "execution" pointcut, what you get is MethodInvocation, and you will only have access to the called method.

If you use call + withincode on your pointcut expression, you can specify  the method called (inside of call), and the caller method (inside of withincode).

Look at this example:

  | call(int java.util.ArrayList->size()) AND withincode(void Driver->caller())
  | 

This pointcut expression matches all calls to ArrayList.size() made by the method Driver.caller(). Look at the complete example here:
http://labs.jboss.com/portal/jbossaop/docs/1.5.0.GA/docs/aspect-framework/examples/caller/caller.html

We will allow more flexibility in this area on JBoss AOP 2.0. You will be able to receive the caller and the target of the call as arguments to your advice.

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

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



More information about the jboss-user mailing list