Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Selective method calls and returns

Ron,

I am trying to record entry and exit points of all topmost public method
executions in a class, which are invoked within a normal program
sequence (i.e. without other aspects being weaved in). 

If A calls helper class and helper class then calls B, I just want to
record A execution, so !cflowbelow works in this case. The problem is
that some other aspects trigger call B right before returning from A.
This call to B gets picked up by the pointcut, because it is not within
the cflowbelow of A, but in some other aspect instead.

Regards.

Oleg

-----Original Message-----
From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
Sent: Friday, May 13, 2005 10:21 AM
To: 'AspectJ developer discussions'
Subject: RE: [aspectj-dev] Selective method calls and returns


Hi Oleg, 

Does after returning advice on the same pointcut meet your needs? If
not, why? Are you trying to share state between the before and after
returning advice?

By the way, one thing to consider in using cflowbelow is whether you
might have a situation where A calls a helper class, that calls back on
B. If you don't want to capture those calls to B, using !cflowbelow
matches your requirements.

-----Original Message-----
From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Oleg Lebedev
Sent: Thursday, May 12, 2005 4:01 PM
To: AspectJ developer discussions
Subject: [aspectj-dev] Selective method calls and returns

Greetings.

I am wondering if you could help me with the following interesting
problem.

I need to track executions of all public methods in a given class. Some
of the public methods call other public methods, but only the top ones
should be tracked when called. So, if methods A and B are public and A
calls B internally, then when A is called only A execution should be
tracked and B execution should not be tracked. However, if B is directly
called by some external class, then it should be tracked as well.

Suppose allPublic() pointcut describes all public method executions in
the class, then the following advice will do what I want:

before () : allPublic() && !cflowbelow(allPublic()) {}

Here is the tricky part. I also need to track when methods picked up by
this advice return. So, in the case above, if method A is called, and
then internally calls method B, I only want to know when method A
returns, and ignore the return of method B. However, if method B is
called by some external class (and therefore is picked up by the advice
above), then I need to know when B returns as well.

Any ideas?

Thanks.

Oleg
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
If you have questions about this email, please
contact the IT Help Desk.

Mail



Back to the top