类 JamonPerformanceMonitorInterceptor
java.lang.Object
cn.taketoday.aop.interceptor.AbstractTraceInterceptor
cn.taketoday.aop.interceptor.AbstractMonitoringInterceptor
cn.taketoday.aop.interceptor.JamonPerformanceMonitorInterceptor
- 所有已实现的接口:
Serializable,Advice,Interceptor,MethodInterceptor
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
- 另请参阅:
-
MonitorFactoryPerformanceMonitorInterceptor- 序列化表格
-
字段概要
从类继承的字段 cn.taketoday.aop.interceptor.AbstractTraceInterceptor
defaultLogger -
构造器概要
构造器构造器说明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 ObjectinvokeUnderTrace(MethodInvocation invocation, Logger logger) Wraps the invocation with a JAMon Monitor and writes the current performance statistics to the log (if enabled).protected booleanisInterceptorEnabled(MethodInvocation invocation, Logger logger) Always applies the interceptor if the "trackAllInvocations" flag has been set; else just kicks in if the log is enabled.voidsetTrackAllInvocations(boolean trackAllInvocations) Set whether to track all invocations that go through this interceptor, or just invocations with trace logging enabled.protected voidtrackException(com.jamonapi.MonKey key, Throwable ex) Count the thrown exception and put the stack trace in the details portion of the key.从类继承的方法 cn.taketoday.aop.interceptor.AbstractMonitoringInterceptor
createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffix从类继承的方法 cn.taketoday.aop.interceptor.AbstractTraceInterceptor
getClassForLogging, getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLogExceptionStackTrace, setLoggerName, setUseDynamicLogger, writeToLog, writeToLog
-
构造器详细资料
-
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 loggertrackAllInvocations- 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
Always applies the interceptor if the "trackAllInvocations" flag has been set; else just kicks in if the log is enabled.- 覆盖:
isInterceptorEnabled在类中AbstractTraceInterceptor- 参数:
invocation- theMethodInvocationbeing tracedlogger- theLoggerinstance to check- 另请参阅:
-
invokeUnderTrace
Wraps the invocation with a JAMon Monitor and writes the current performance statistics to the log (if enabled).- 指定者:
invokeUnderTrace在类中AbstractTraceInterceptorlogger- theLoggerto write trace messages to- 返回:
- the result of the call to
MethodInvocation.proceed() - 抛出:
Throwable- if the call toMethodInvocation.proceed()encountered any errors- 另请参阅:
-
MonitorFactory.start(java.lang.String)Monitor.stop()
-
trackException
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.
-