Top Description Constructors Methods
org.springframework.aop.interceptor

public Class PerformanceMonitorInterceptor

extends AbstractMonitoringInterceptor
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log, org.springframework.util.StopWatch

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.

Authors
Rod Johnson, Dmitriy Kopylenko, Rob Harrop
See Also
org.springframework.util.StopWatch

Constructor Summary

AccessConstructor and Description
public
PerformanceMonitorInterceptor()

Create a new PerformanceMonitorInterceptor with a static logger.

public
PerformanceMonitorInterceptor(boolean
whether to use a dynamic logger or a static logger
useDynamicLogger
)

Create a new PerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.

Method Summary

Modifier and TypeMethod and Description
protected Object
invokeUnderTrace(MethodInvocation invocation, Log
the Log to write trace messages to
logger
)

Implements abstract org.springframework.aop.interceptor.AbstractTraceInterceptor.invokeUnderTrace.

Subclasses must override this method to perform any tracing around the supplied MethodInvocation.
Inherited from org.springframework.aop.interceptor.AbstractMonitoringInterceptor:
createInvocationTraceNamegetPrefixgetSuffixsetLogTargetClassInvocationsetPrefixsetSuffix

Constructor Detail

PerformanceMonitorInterceptorback to summary
public PerformanceMonitorInterceptor()

Create a new PerformanceMonitorInterceptor with a static logger.

PerformanceMonitorInterceptorback to summary
public PerformanceMonitorInterceptor(boolean useDynamicLogger)

Create a new PerformanceMonitorInterceptor with a dynamic or static logger, according to the given flag.

Parameters
useDynamicLogger:boolean

whether to use a dynamic logger or a static logger

See Also
setUseDynamicLogger

Method Detail

invokeUnderTraceback to summary
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable

Implements abstract org.springframework.aop.interceptor.AbstractTraceInterceptor.invokeUnderTrace.

Doc from org.springframework.aop.interceptor.AbstractTraceInterceptor.invokeUnderTrace.

Subclasses must override this method to perform any tracing around the supplied MethodInvocation. Subclasses are responsible for ensuring that the MethodInvocation actually executes by calling MethodInvocation.proceed().

By default, the passed-in Log instance will have log level "trace" enabled. Subclasses do not have to check for this again, unless they overwrite the isInterceptorEnabled method to modify the default behavior, and may delegate to writeToLog for actual messages to be written.

Parameters
logger:Log

the Log to write trace messages to

Returns:Object

the result of the call to MethodInvocation.proceed()

Annotations
@Override
Exceptions
Throwable:
if the call to MethodInvocation.proceed() encountered any errors