[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Slow if()

I'm afraid that isn't possible right now.  We do support an optimized
implementation of if() pcds that only builds thisJoinPoint if the if()
condition succeeds but if() can only use static information. (I'm
talking code style here rather than annotation style).  I have thought
about improving that if() optimization for certain other situations
but haven't had the time to look into it yet - you could raise an
enhancement request where we could discuss it further in that.
Possibly I had been thinking about exposing the aspect instance for
use in the if(), maybe that plus a perthis() instantiation model would
help your situation.

Andy.

2008/7/3 Marijn Meijles <marijn@xxxxxxxxxx>:
> Hi!
>
> I have a problem with my around advice. The advice itself is really slow
> because it does all kind of reflection stuff and needs access to  this (the
> current aspected instance). However, it should only run about 1% of the time
> and that depends   on the return value of a getter on this. Now my question
> is: how do I tell AspectJ to only run the advice and do all kinds of  time
> consuming stuff if the value from the getter is not null?
>
> I tried a pointcut with "... && this(entity) && if()" whereby the method
> body returns "entity.getParent() != null" but this doesn't help, probably
> because the ProceedingJoinPoint is created for the @Pointcut method as well.
>
> Any help would  be greatly appreciated.
> --
> Marijn
> ---
> This line says this line says
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>