Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Question on disabling aspect...

I am trying to find out if AspectJ is capable of addressing the following issue. I have a certain set of methods that are all intercepted by an aspect I created. The aspect intercepts all methods and logs some information pertaining to each method invocation.

method1() -> logs something
method2() -> logs something else
method3() -> logs my pijamas

I have another method that when invoked may make a call to either of these methods. However, any methods invoked from this special method should not trigger the logging aspect.

diagnosticMethod() -> calls
                               -> method1() -> logs nothing
                               -> method2() -> logs nothing
                               -> method3() -> logs nothing

Is there any way of defining a pointcut such that any method invocations resulting from diagnosticMethod() will NOT trigger the aspect? I would rather not have to resort to manually enabling and disabling the aspect based on a ThreadLocal variable.

Thanks for any pointers.

-Kyle



Back to the top