public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterceptor
This code is inspired by Thierry Templier's blog.
MonitorFactory,
PerformanceMonitorInterceptor,
Serialized FormdefaultLogger| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
invokeUnderTrace(org.aopalliance.intercept.MethodInvocation invocation,
org.apache.commons.logging.Log logger)
Wraps the invocation with a JAMon Monitor and writes the current
performance statistics to the log (if enabled).
|
protected boolean |
isInterceptorEnabled(org.aopalliance.intercept.MethodInvocation invocation,
org.apache.commons.logging.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.
|
createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffixgetClassForLogging, getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLoggerName, setUseDynamicLoggerpublic 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(org.aopalliance.intercept.MethodInvocation invocation,
org.apache.commons.logging.Log logger)
isInterceptorEnabled in class AbstractTraceInterceptorinvocation - the MethodInvocation being tracedlogger - the Log instance to checksetTrackAllInvocations(boolean),
AbstractTraceInterceptor.isLogEnabled(org.apache.commons.logging.Log)protected Object invokeUnderTrace(org.aopalliance.intercept.MethodInvocation invocation, org.apache.commons.logging.Log logger) throws Throwable
invokeUnderTrace in class 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()Copyright © 2015. All rights reserved.