Announcement Announcement Module
No announcement yet.
Execute advice once, then remove it Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Execute advice once, then remove it

    I have code that I would like to run one or more times any time a method in my DAO class is called. This sounds to me like a candidate for using APO.

    However, at some point ( after two or more methods are run ), I would like to remove the advice. What is the best way to accomplish this? I have seen examples of using removeAdvice() but they were all related to instantiation proxies by hand in code.

    How much overhead is there in having advice on an object that is used as frequently as a DAO? Will there still be code executed related to AOP if all advice is removed for an object?

    Are there other better alternatives that I might have missed?

  • #2
    Hi there

    have you thought about switching the advice off during runtime with the use of JMX? I'm not sure how you can remove the advice at runtime. You could have a flag in the advice and use JMX to get an handle on the advice (Aspects.aspectOf()).

    Not sure if that would be what your looking for.