类 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.

从以下版本开始:
3.0
作者:
Dmitriy Kopylenko, Juergen Hoeller, Rob Harrop, Steve Souza, TODAY
另请参阅:
  • 构造器详细资料

    • 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
      另请参阅:
    • 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
      另请参阅:
  • 方法详细资料

    • 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, Logger 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 Logger instance to check
      另请参阅:
    • invokeUnderTrace

      protected Object invokeUnderTrace(MethodInvocation invocation, Logger 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 Logger 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.