Version 4

    The org.jboss.ejb.plugins.MetricsInterceptor

     

    This server-side container interceptor is a legacy one, dating from the days of

    JBoss v2.0. It is part of most container configurations, e.g.

    ...
    <container-interceptors>
       <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
       <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
       <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
       <!-- CMT -->
       <interceptor>transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
       <interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
       <interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
       <!-- BMT -->
       <interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
       <interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
       <interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
       <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
    </container-interceptors>
    ...
    

    The interceptor monitors calls to the home and bean interface of the targeted

    EJB and puts invocation metrics (per invocation) to an internal queue.

    A separate thread wakes-up every 2 seconds, dequeues the metrics and sends them

    to a predefined JMS topic called metrics.

     

    Since this interceptor is marked with metricsEnabled="true", to activate it

    you need to configure the EJBDeployer with:

    ...
    <attribute name="MetricsEnabled">true</attribute>
    ...
    

    In this case the metrics topic must be present, with an entry in the jbossmq-destinations-service.xml:

      <mbean code="org.jboss.mq.server.jmx.Topic"
          name="jboss.mq.destination:service=Topic,name=metrics">
        <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
      </mbean>
    

     

    If you activate the interceptor but forget to create the metrics topic, you will

    suffer a horrible death with an OutOfMemory Error, since the publishing thread

    exits and the metrics are accumulated in memory. This is the case until JBoss

    v3.2.8/4.0.4 where this bug

    is solved. Starting from that version you'll also be notificed with a fat

    warning whenever the interceptor is active, or the target metrics topic is missing.

     

    In general, you'll be better off using the statistics provided by the JSR-77 MBeans in JBoss, accessible through any JMX enabled client or the JBoss WebConsole.

     

    Related

     

     

    Referenced by: