[jboss-user] [JBoss AOP] - Are names supposed to be unique in JBoss AOP?

Danamin do-not-reply at jboss.com
Wed Apr 9 15:41:36 EDT 2008


When closely studying the creation of interceptors, there is a strange thing going on: each time an interceptor, aspect or advice is deployed, a new one is made, even if there already is an identical one in the system.

In the MethodExecution example 


  | <aop>
  |    <bind pointcut="execution(public void POJO->noop())">
  |        <interceptor class="SimpleInterceptor"/>
  |    </bind>
  | 
  |    <bind pointcut="execution(* POJO->*(int))">
  |        <interceptor class="MethodInterceptor"/>
  |    </bind>
  | 
  |    <bind pointcut="execution(static * POJO->*(..))">
  |        <interceptor class="MethodInterceptor"/>
  |    </bind>
  | 
  |    <bind pointcut="execution(* POJO$Bar->*(..))">
  |        <interceptor class="MethodInterceptor"/>
  |    </bind>
  | 
  | </aop>
  | 

One would expect there are two aspects with one Interceptor/advice each:
SimpleInterceptor with an invoke advice and
MethodInterceptor with an invoke advice 

This example creates 4 aspects with one advice each:
1 SimpleInterceptor with an invoke advice and
3 MethodInterceptors with an invoke advice  

This could of course be considered a feature. If it is considered a feature, we loose uniqueness of name for aspects and interceptors.

The only unpleasant side effect is that the interceptorFactories and aspectDefinitions fields in the AspectManager are no longer consistent, because they use name as their key.

I don't have a full view of the consequences of this, but I can list a few

  | * debugging information is inconsistent
  | * when the second aspect with the same name is deployed, the first one is undeployed, this removes it from all advisors, but it's bindings (and interceptors) remain active, the bindings will continue to create instances of the aspect, which can no longer be centrally undeployed
  | * bindings silently replace each other, correctly as far as I can see
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142956#4142956

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142956



More information about the jboss-user mailing list