Hi,

I am experimenting interceptors, and testing the "after" "before" attributes, so I create two interceptors like the NullInterceptor mentionned in the doc
---------------------------------------------------------------------------------------------------------------
I just modify the class to be added to the ClassFab in order to have some logs
classFab.addMethod(Modifier.PUBLIC,
                        sig,
                        "{_inner.getLog().info(\"---------Interceptor_Name\");  return ($r) _inner." + methodName + "($$) ; }");
 ---------------------------------------------------------------------------------------------------------------
in the example.sdl I add these declarations:

 service-point (id=SecurityInterceptor interface=org.apache.hivemind.ServiceInterceptorFactory) {
        invoke-factory (service-id=hivemind.BuilderFactory ){
                construct (class=org.apache.hivemind.examples.impl.SecurityInterceptor)
        }
  }
 

  service-point (id=TestInterceptor interface=org.apache.hivemind.ServiceInterceptorFactory) {
          invoke-factory (service-id=hivemind.BuilderFactory ){
                  construct (class=org.apache.hivemind.examples.impl.TestInterceptor )
          }
        } 
--------------------------------------------------------------------------------------------------------------
and I add
these interceptors to  Calculator  declaration

service-point (id=Calculator interface=org.apache.hivemind.examples.Calculator)
{
    invoke-factory (service-id=hivemind.BuilderFactory)
    {
        construct (class= org.apache.hivemind.examples.impl.CalculatorImpl)
        {
        }
    }
    interceptor (service-id=hivemind.LoggingInterceptor )
    interceptor (service-id=SecurityInterceptor )
    interceptor (service-id=TestInterceptor)
}
 
my question is : why hivemind call twice one of my interceptors?
Calculator [DEBUG] BEGIN divide(1.0, 2.0)
Calculator [INFO] ---------test
Calculator [INFO] ---------security
Calculator [INFO] ---------test
Divider [DEBUG] Constructing core service implementation for service examples.Divider
Divider [DEBUG] Applying interceptor factory hivemind.LoggingInterceptor
Divider [DEBUG] BEGIN divide(1.0, 2.0)
Divider [DEBUG] END divide() [0.5]
Calculator [DEBUG] END divide() [0.5]
--------------------------------------------------------------------------------------------------------------
thanks a lot for your patience

Reply via email to