Class PerformanceMonitorInterceptor
java.lang.Object
org.springframework.aop.interceptor.AbstractTraceInterceptor
org.springframework.aop.interceptor.AbstractMonitoringInterceptor
org.springframework.aop.interceptor.PerformanceMonitorInterceptor
- All Implemented Interfaces:
Serializable,Advice,Interceptor,MethodInterceptor
Simple AOP Alliance
MethodInterceptor for performance monitoring.
This interceptor has no effect on the intercepted method call.
Uses a StopWatch for the actual performance measuring.
- Author:
- Rod Johnson, Dmitriy Kopylenko, Rob Harrop
- See Also:
-
Field Summary
Fields inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor
defaultLogger -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PerformanceMonitorInterceptor with a static logger.PerformanceMonitorInterceptor(boolean useDynamicLogger) Create a new PerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectinvokeUnderTrace(MethodInvocation invocation, Log logger) Subclasses must override this method to perform any tracing around the suppliedMethodInvocation.Methods inherited from class org.springframework.aop.interceptor.AbstractMonitoringInterceptor
createInvocationTraceName, getPrefix, getSuffix, setLogTargetClassInvocation, setPrefix, setSuffixMethods inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptor
getClassForLogging, getLoggerForInvocation, invoke, isInterceptorEnabled, isLogEnabled, setHideProxyClassNames, setLogExceptionStackTrace, setLoggerName, setUseDynamicLogger, writeToLog, writeToLog
-
Constructor Details
-
PerformanceMonitorInterceptor
public PerformanceMonitorInterceptor()Create a new PerformanceMonitorInterceptor with a static logger. -
PerformanceMonitorInterceptor
public PerformanceMonitorInterceptor(boolean useDynamicLogger) Create a new PerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.- Parameters:
useDynamicLogger- whether to use a dynamic logger or a static logger- See Also:
-
-
Method Details
-
invokeUnderTrace
Description copied from class:AbstractTraceInterceptorSubclasses must override this method to perform any tracing around the suppliedMethodInvocation. Subclasses are responsible for ensuring that theMethodInvocationactually executes by callingMethodInvocation.proceed().By default, the passed-in
Loginstance will have log level "trace" enabled. Subclasses do not have to check for this again, unless they overwrite theisInterceptorEnabledmethod to modify the default behavior, and may delegate towriteToLogfor actual messages to be written.- Specified by:
invokeUnderTracein classAbstractTraceInterceptorlogger- theLogto write trace messages to- Returns:
- the result of the call to
MethodInvocation.proceed() - Throws:
Throwable- if the call toMethodInvocation.proceed()encountered any errors- See Also:
-