Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Running code once in an aspect

Hey, Rob. AspectJ does currently not support any "dynamic aspect
disablement". Hence, the only way to work around this is to use a
boolean flag. If you put this flag into an if-pointcut, this should be
fairly fast, as this flag is then evaluated quite early in the
matching process.

HTH,
Eric

On 30/10/2007, Rob Austin <austirob@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> I'm afraid I have a beginners question. I was wondering if it is possible to
> place code in an aspect that is only executed once.
> For instance, I am writing an aspect which will monitor a method in another
> class. The aspect itself needs to instantiate an object that will do this.
> Naturally I will use a singleton pattern to get a reference to this object,
> but this still seems inefficient, as the aspect will be called each time the
> method is called meaning a conditional statement is called in the Singleton
> each time.
>
> I feel like I'm going the wrong way about this. Any help would be
> appreciated.
>
> Thanks
>
> Rob
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top