2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Jakarta > HiveMind
Font size:      

Measure service performance

The interceptor PerformanceMonitor collects statistical data about calls to a service. The results are sent to a newly created mbean. For each service method it displays: number of calls, maximum, minimum, average and last execution duration.
Add the Interceptor to your service and choose which methods are to be intercepted by inclusion and exclusion:

<service-point id="Calculator" 
    <construct class="org.apache.hivemind.management.CalculatorImpl" />
  <interceptor service-id="hivemind.management.PerformanceMonitorFactory">
    <exclude method="getSum"/>
    <include method="add"/>
    <include method="subtract"/>

The statistics are displayed by a MBean named like your service, with an additional name part "decorator=PerformanceCollector":

Performance Interceptor MBean

By default a service - and thus it's interceptors - is created on the first call of a service method. If you want to get the performance mbean at startup, add your service to the EagerLoad contribution.