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" interface="org.apache.hivemind.management.Calculator"> <invoke-factory> <construct class="org.apache.hivemind.management.CalculatorImpl" /> </invoke-factory> <interceptor service-id="hivemind.management.PerformanceMonitorFactory"> <exclude method="getSum"/> <include method="add"/> <include method="subtract"/> </interceptor> </service-point>
The statistics are displayed by a MBean named like your service,
with an additional name part "decorator=PerformanceCollector":
Note
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.