Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Dynamically disable a pointcut

If indeed isTraceEnabled is set to 'false', your pointcut will not select anything and you shouldn't get any tracing. Try printing isTraceEnabled in your advice to see if it has been set to 'true'.

-Ramnivas

On Tue, Jun 29, 2010 at 8:37 AM, rampaadh <rampaadh@xxxxxxxxxxx> wrote:

I am new user to AspectJ Programming. I am writing a custom aspect to trace
method entry and exit points.

I have a pointcut and a boolean variable isTraceEnabled to control it.

--------------------------
private static boolean isTraceEnabled = false;
pointcut traceMethods(): if (isTraceEnabled)
                                         && (execution(* *.*(..)) || execution(*.new(..)))
                                        && !within(com.sample.TraceAspect)
                                        && !execution(* *.*$*(..))
                                        && !within(Pointcuts.*);
--------------------------

But though I have disabled the pointcut, still it evaluates all the method
entries / exits.  Hence I am getting performance issues.  Is there any way
to completely disable the pointcut and enable it whenever I want?

I read few articles in this forum, everyone suggested having a boolean
variable, but it seems not working to me.  Method entry/exits are still
evaulated even the boolean variable value is false.
--
View this message in context: http://aspectj.2085585.n4.nabble.com/Dynamically-disable-a-pointcut-tp2272366p2272366.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top