org.springframework.aop.interceptor

## 类 JamonPerformanceMonitorInterceptor

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

- 所有已实现的接口:
    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. In addition, it tracks/counts exceptions thrown by the intercepted method. The stack traces can be viewed in the JAMon web application.

  This code is inspired by Thierry Templier's blog.

  从以下版本开始:
    1.1.3
  作者:
    Dmitriy Kopylenko, Juergen Hoeller, Rob Harrop, Steve Souza
  另请参阅:
    `MonitorFactory`, `PerformanceMonitorInterceptor`, 序列化表格

- - ### 字段概要

    - ### 从类继承的字段 org.springframework.aop.interceptor.AbstractTraceInterceptor

      `defaultLogger`

  - ### 构造器概要

    构造器
    构造器和说明
    `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.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `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.
    `protected void` | `trackException(com.jamonapi.MonKey key, Throwable ex)` Count the thrown exception and put the stack trace in the details portion of the key.

    - ### 从类继承的方法 org.springframework.aop.interceptor.AbstractMonitoringInterceptor

      `createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffix`

    - ### 从类继承的方法 org.springframework.aop.interceptor.AbstractTraceInterceptor

      `getClassForLogging, getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLogExceptionStackTrace, setLoggerName, setUseDynamicLogger, writeToLog, writeToLog`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### 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.
      参数:
        `useDynamicLogger` - whether to use a dynamic logger or a static logger
      另请参阅:
        `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.
      参数:
        `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
      另请参阅:
        `AbstractTraceInterceptor.setUseDynamicLogger(boolean)`

  - ### 方法详细资料

    - #### 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.
      覆盖:
        `isInterceptorEnabled` 在类中 `AbstractTraceInterceptor`
      参数:
        `invocation` - the `MethodInvocation` being traced
        `logger` - the `Log` instance to check
      另请参阅:
        `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).
      指定者:
        `invokeUnderTrace` 在类中 `AbstractTraceInterceptor`
        `logger` - the `Log` to write trace messages to
      返回:
        the result of the call to `MethodInvocation.proceed()`
      抛出:
        `Throwable` - if the call to `MethodInvocation.proceed()` encountered any errors
      另请参阅:
        `MonitorFactory.start(java.lang.String)`, `Monitor.stop()`

    - #### trackException

          protected void trackException(com.jamonapi.MonKey key,
                                        Throwable ex)

      Count the thrown exception and put the stack trace in the details portion of the key. This will allow the stack trace to be viewed in the JAMon web application.