Skip to main content

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

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.


Back to the top