Sorry, for some reason my xml lines got stripped off, the aop xml looks like
<pointcut name="Method1" expr="execution(* test.TestServiceBean->method1(java.lang.String))" /> <pointcut name="AllMethods" expr="execution(* test.TestServiceBean->*(..))" /> <bind pointcut="Method1"> <interceptor class="Interceptor1" /> </bind> <bind pointcut="AllMethods"> <stack name = "StackOne" /> </bind>
In my experience the bindings are applied "top-down", i.e. in your example Interceptor1 should be applied before StackOne. I'm not 100% sure if this is documented behaviour though
Taken a quick look at the code for the above, and the assumption above regarding ordering of interceptors seems safe.
Now, in response to your actual question :-) The global/specific stuff is fine.
You can hotdeploy a pointcut definition, but this does not cause bindings to be reapplied. Am I making sense? So, if you modify "AllMethods" at runtime and redeploy it, bindings will not be recalculated.
Currently, the code isn't smart enough to know if the binding references a "named" pointcut.
Does this screw up what you want to do?
Well, not sure if what I'm doing qualifies as hot-deploy or not, but I have a console that acts as an interface to dynamically at run-time attach and detach advices to the advice stacks. And in turn the advice stacks updates every AdviceBinding that it references internally.
My concern is more in terms of the order of the interception. I would prefer the interceptors/advices/stacks bound in the "all methods" pointcut intercept first and then the specific method pointcut bindings intercept next.
Is that correct?
So I just did a small experiment and it seems like in whatever order the advice bindings were created, that was the order in which the advices/interceptors were ordered.
Meaning if I attached the advice to SpecificMethod pointcut binding first and then AllMethods pointcut binding next. Then that would be the order of the interceptors.
Since they are two different "AdviceBindings" I thought the instrumented code would always look for the "AllMethods" advice bindings first and then the "SpecificMethod" advice bindings next.
any thoughts ?