Skip to main content

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

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
 

Back to the top