|Re: [aspectj-users] What's the different between call and execution|
|For calls, the advice is inserted just before transferring control to the method. For execution, the advice is inserted just after transferring control, within the stack frame of the method. (This is my naive way of viewing it.)|
One implication is that you have to use call pointcuts if you want to advise invocations of code in a 3rd-party jar that you aren't modifying with advice. For example, suppose you want to log all calls to HashMap.get() for some reason. Call pointcuts would add advice everywhere in your code that get() is called. If you tried to write an execution pointcut for the get method, it would only work if you inserted the advice in the JDK!
An advantage of execution advice, when you can use it, is that you only have the overhead of advice code in one place, whereas call advice is inserted everywhere that target method is called.
They AspectJ docs have better explanations of all this ;)
On Jun 4, 2008, at 10:52 AM, Noppanit Charassinvichai wrote: