|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.interceptor.AbstractTraceInterceptor org.springframework.aop.interceptor.AbstractMonitoringInterceptor org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor
public class JamonPerformanceMonitorInterceptor
Performance monitor interceptor that uses JAMon library to perform the performance measurement on the intercepted method and output the stats.
This code is inspired by Thierry Templier's blog.
MonitorFactory
,
PerformanceMonitorInterceptor
,
Serialized FormField Summary |
---|
Fields inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor |
---|
defaultLogger |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.springframework.aop.interceptor.AbstractMonitoringInterceptor |
---|
createInvocationTraceName, getPrefix, getSuffix, setPrefix, setSuffix |
Methods inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor |
---|
getLoggerForInvocation, invoke, isLogEnabled, setHideProxyClassNames, setLoggerName, setUseDynamicLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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)
Method Detail |
---|
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
in class AbstractTraceInterceptor
invocation
- 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
in class AbstractTraceInterceptor
logger
- the Log
to write trace messages to
MethodInvocation.proceed()
Throwable
- if the call to MethodInvocation.proceed()
encountered any errorsMonitorFactory.start(java.lang.String)
,
Monitor.stop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |