Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.aop.interceptor
Class JamonPerformanceMonitorInterceptor

    java.lang.Object
      org.springframework.aop.interceptor.AbstractTraceInterceptor
          org.springframework.aop.interceptor.AbstractMonitoringInterceptor
              org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor

All Implemented Interfaces:
  Serializable, Advice, Interceptor, MethodInterceptor

    public class JamonPerformanceMonitorInterceptor

extends AbstractMonitoringInterceptor

Performance monitor interceptor that uses JAMon library to perform the performance measurement on the intercepted method and output the stats.

This code is inspired by Thierry Templier's blog.

Since:
  1.1.3
Author:
  Dmitriy Kopylenko, Juergen Hoeller, Rob Harrop
See Also:
  `MonitorFactory`, `PerformanceMonitorInterceptor`, Serialized Form

Field Summary

Fields inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor
`defaultLogger`

Constructor Summary
`JamonPerformanceMonitorInterceptor()` Create a new JamonPerformanceMonitorInterceptor with a static logger.
`JamonPerformanceMonitorInterceptor(boolean useDynamicLogger)` Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.
`JamonPerformanceMonitorInterceptor(boolean useDynamicLogger, boolean trackAllInvocations)` Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.

Method Summary
`protected Object` | `invokeUnderTrace(MethodInvocation invocation, Log logger)` Wraps the invocation with a JAMon Monitor and writes the current performance statistics to the log (if enabled).
`protected boolean` | `isInterceptorEnabled(MethodInvocation invocation, Log logger)` Always applies the interceptor if the "trackAllInvocations" flag has been set; else just kicks in if the log is enabled.
`void` | `setTrackAllInvocations(boolean trackAllInvocations)` Set whether to track all invocations that go through this interceptor, or just invocations with trace logging enabled.

Methods inherited from class org.springframework.aop.interceptor.AbstractMonitoringInterceptor
`createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffix`

Methods inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor
`getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLoggerName, setUseDynamicLogger`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JamonPerformanceMonitorInterceptor

    public JamonPerformanceMonitorInterceptor()

  Create a new JamonPerformanceMonitorInterceptor with a static logger.

### JamonPerformanceMonitorInterceptor

    public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger)

  Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.

  Parameters:
    `useDynamicLogger` - whether to use a dynamic logger or a static logger
  See Also:
    `AbstractTraceInterceptor.setUseDynamicLogger(boolean)`

### JamonPerformanceMonitorInterceptor

    public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger,
                                              boolean trackAllInvocations)

  Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.

  Parameters:
    `useDynamicLogger` - whether to use a dynamic logger or a static logger
    `trackAllInvocations` - whether to track all invocations that go through this interceptor, or just invocations with trace logging enabled
  See Also:
    `AbstractTraceInterceptor.setUseDynamicLogger(boolean)`

Method Detail

### setTrackAllInvocations

    public void setTrackAllInvocations(boolean trackAllInvocations)

  Set whether to track all invocations that go through this interceptor, or just invocations with trace logging enabled.

  Default is "false": Only invocations with trace logging enabled will be monitored. Specify "true" to let JAMon track all invocations, gathering statistics even when trace logging is disabled.

### isInterceptorEnabled

    protected boolean isInterceptorEnabled(MethodInvocation invocation,
                                           Log logger)

  Always applies the interceptor if the "trackAllInvocations" flag has been set; else just kicks in if the log is enabled.

  Overrides:
    `isInterceptorEnabled` in class `AbstractTraceInterceptor`
  Parameters:
    `invocation` - the `MethodInvocation` being traced
    `logger` - the `Log` instance to check
  See Also:
    `setTrackAllInvocations(boolean)`, `AbstractTraceInterceptor.isLogEnabled(org.apache.commons.logging.Log)`

### invokeUnderTrace

    protected Object invokeUnderTrace(MethodInvocation invocation,
                                      Log logger)
                               throws Throwable

  Wraps the invocation with a JAMon Monitor and writes the current performance statistics to the log (if enabled).

  Specified by:
    `invokeUnderTrace` in class `AbstractTraceInterceptor`
    `logger` - the `Log` to write trace messages to
  Returns:
    the result of the call to `MethodInvocation.proceed()`
  Throws:
    `Throwable` - if the call to `MethodInvocation.proceed()` encountered any errors
  See Also:
    `MonitorFactory.start(java.lang.String)`, `Monitor.stop()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.