[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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:

Can anyone please tell me what is the different between call and execution in Pointcut? Thank you
aspectj-users mailing list

Dean Wampler, Ph.D.
dean at objectmentor.com
See also:
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5