public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterceptor
This code is inspired by Thierry Templier's blog.
MonitorFactory,
PerformanceMonitorInterceptor,
序列化表格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.
|
createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffixgetClassForLogging, getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLogExceptionStackTrace, setLoggerName, setUseDynamicLogger, writeToLog, writeToLogpublic JamonPerformanceMonitorInterceptor()
public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger)
useDynamicLogger - whether to use a dynamic logger or a static loggerAbstractTraceInterceptor.setUseDynamicLogger(boolean)public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger,
boolean trackAllInvocations)
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 enabledAbstractTraceInterceptor.setUseDynamicLogger(boolean)public void setTrackAllInvocations(boolean trackAllInvocations)
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.
protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger)
isInterceptorEnabled 在类中 AbstractTraceInterceptorinvocation - the MethodInvocation being tracedlogger - the Log instance to checksetTrackAllInvocations(boolean),
AbstractTraceInterceptor.isLogEnabled(org.apache.commons.logging.Log)protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable
invokeUnderTrace 在类中 AbstractTraceInterceptorlogger - the Log to write trace messages toMethodInvocation.proceed()Throwable - if the call to MethodInvocation.proceed()
encountered any errorsMonitorFactory.start(java.lang.String),
Monitor.stop()protected void trackException(com.jamonapi.MonKey key,
Throwable ex)