!within(XXX) excludes join points in XXX. The call to the method is in the
aspect, but not execution (it is in the DAO class).

The examples you see where !within() work, call a method of an aspect
itself, thus !within(ASPECT-NAME) excludes call to the method as well as
execution.

-Ramnivas

On Tue, Jul 13, 2010 at 6:22 PM, Stephen Boesch <java...@gmail.com> wrote:

> What you show below is happening, but should have been avoided by the
> !within(*ApplyStatisticsDaoAllPublicMethodsAspect).  *
>
> **So my original (and present) question was not really answered.  Here
> again is what I have, which mimics many examples out there.
>
>   @Around (value="execution(public * *(..)) && *
> !within(ApplyStatisticsDaoAllPublicMethodsAspect)* && this(dao)",
> argNames="thisJoinPoint, dao")
>
>  But it does have the recursion.
>
> 2010/7/13 Stephen Boesch <java...@gmail.com>
>
> Funny I had seen examples using !within(<AspectClass>).   So I coded
>> !within(ApplyStatisicsDaoAllPublicMethodsAspect).
>>
>> Is the !clowbelow(within<AspectClass>)) required then?  I wonder why those
>> other examples worked in that case.
>>
>> 2010/7/13 Ramnivas Laddad <ramni...@aspectivity.com>
>>
>> You will need to exclude *getStatisticsSource() *from being advised (or
>>> add !cflowbelow(within(ApplyStatisticsDaoAllPublicMethodsAspect))
>>>
>>> The reason you get infinite recursion is the following call sequence:
>>> 1. A method executed on dao
>>> 2. Advice executes
>>> 3. Advice calls *getStatisticsSource*
>>> 4. Since that is a method on dao (and its execution is not within the
>>> aspect)... go to 1
>>>
>>> -Ramnivas
>>>
>>> On Tue, Jul 13, 2010 at 1:40 PM, Stephen Boesch <java...@gmail.com>wrote:
>>>
>>>> In the following aspect, the bolded methods cause infinite recursion due
>>>> to re-invocation of the pointcut.  I don't get it: the pointcut conditions
>>>> include
>>>>
>>>>
>>>> * !within(ApplyStatisticsDaoAllPublicMethodsAspect) *
>>>>
>>>> So why did that not avoid the recursion?
>>>>
>>>>
>>>> @Aspect
>>>> public class ApplyStatisticsDaoAllPublicMethodsAspect {
>>>>
>>>> @Aspect
>>>> public class ApplyStatisticsDaoAllPublicMethodsAspect {
>>>>
>>>> @Around(value = "execution(public * WaterfallOrmDao+.find* (..)) &&
>>>> !within(ApplyStatisticsDaoAllPublicMethodsAspect) && this(dao)", argNames =
>>>> "thisJoinPoint, dao")
>>>>   public Object aroundApplyStatisticsMethod (ProceedingJoinPoint
>>>> thisJoinPoint, WaterfallORMDao dao)
>>>>     throws Throwable {
>>>>
>>>> ..
>>>>         executedMethod =
>>>> ((MethodSignature)thisJoinPoint.getSignature()).getMethod();
>>>>
>>>>  STATISTICS_FACTORY.getStatistics().addStatLine(dao.getManagedClass(),
>>>> executedMethod, *dao.getStatisticsSource(),* stop - start);
>>>>       LOG.warn(dao.getManagedClass()+" "+ executedMethod+" "+ *
>>>> dao.getStatisticsSource()*+" " + (stop - start));
>>>>  ..
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> aspectj-users mailing list
>>>> aspectj-users@eclipse.org
>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@eclipse.org
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>>
>>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to