Skip to main content

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

The if() pointcut is a evaluated dynamic (i.e. at runtime). That allows runtime control over aspect. The initial value has no influence over weaving. So in this case, AspectJ will weave in the aspect, but at runtime check the variable and not execute the advice.

-Ramnivas

On Thu, Jul 1, 2010 at 12:40 PM, rampaadh <rampaadh@xxxxxxxxxxx> wrote:

Andy and all,

Thanks for your responses.  I am attaching a file which contains my Aspect.

http://aspectj.2085585.n4.nabble.com/file/n2275617/TraceAspect.aj
TraceAspect.aj

nitially I am having isTraceEnabled flag as "False".  I am controlling the
isTraceEnabled flag through a JSP which accesses the trace aspect through
JNDI.

I have following configuration in my weblogic startup script. I am using
Weblogic 8.

set MJ_LIB=C:\bea\user_projects\domains\unitdomain8v3\MethodLogger
set JAVA_OPTIONS=%JAVA_OPTIONS%
-Xmanagement:class=org.aspectj.weaver.loadtime.JRockitAgent
-Daj.weaving.verbose=false -Xmx509m
set CLASSPATH=%MJ_LIB%\aspectjweaver.jar;%MJ_LIB%;%CLASSPATH%

I enabled weaver options to -showWeaveInfo in aop.xml

<weaver options="-proceedOnError -showWeaveInfo">

When I start weblogic,  since isTraceEnabled is set to false, I am expecting
no class should be processed.  But I am seeing lot of weave info messages
while weblogic loads any class during the start up?

--Example weaver logs which i get during the weblogic startup ---

[GenericClassLoader@313c448] weaveinfo Join point
'constructor-execution(void com.msn.pat.dao.HDataDAO.<init>())' in Type
'com.msn.pat.dao.HDataDAO' (HDataDAO.java:20) advised by before advice from
'com.sample.TraceAspect' (TraceAspect.aj:33) [with runtime test]
[GenericClassLoader@313c448] weaveinfo Join point
'method-execution(java.util.ArrayList
com.msn.pat.dao.HDataDAO.getMatchedUsers(java.lang.String,
java.lang.String))' in Type 'com.msn.pat.dao.HDataDAO'

-----------
I am sure that isTraceEnabled is set to True and I am not getting any method
entry and exit logs, but why I am getting above weave messages though I turn
the flag off?
--
View this message in context: http://aspectj.2085585.n4.nabble.com/Dynamically-disable-a-pointcut-tp2272366p2275617.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