Class PerformanceInterceptorServiceImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
org.apache.fulcrum.yaafi.interceptor.performance.PerformanceInterceptorServiceImpl
- All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable,org.apache.avalon.framework.configuration.Reconfigurable,org.apache.avalon.framework.context.Contextualizable,org.apache.avalon.framework.logger.LogEnabled,org.apache.avalon.framework.thread.ThreadSafe,AvalonInterceptorService,PerformanceInterceptorService
public class PerformanceInterceptorServiceImpl
extends BaseInterceptorServiceImpl
implements PerformanceInterceptorService, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.thread.ThreadSafe
A service logging the execution time of service invocations.
- Author:
- Siegfried Goeschl
-
Field Summary
Fields inherited from interface org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService
ON_ENTRY, ON_ERROR, ON_EXIT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.apache.avalon.framework.configuration.Configuration configuration) protected voidcreateStopWatch(AvalonInterceptorContext interceptorContext) Creates a stop watchprotected StopWatchgetStopWatch(AvalonInterceptorContext interceptorContext) Gets the stop watchprotected voidlog(int mode, AvalonInterceptorContext interceptorContext, StopWatch stopWatch) Logs the execution time.voidonEntry(AvalonInterceptorContext interceptorContext) Called before a service method is invoked.voidonError(AvalonInterceptorContext interceptorContext, Throwable t) Called when a service method throws an exeptionvoidonExit(AvalonInterceptorContext interceptorContext, Object result) Called after a service method was invoked.voidreconfigure(org.apache.avalon.framework.configuration.Configuration configuration) protected StringPrints the argument list.protected StringtoString(AvalonInterceptorContext interceptorContext, StopWatch stopWatch, int mode) Create the log message for the performance logfile.Methods inherited from class org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
contextualize, getClassLoader, getServiceApplicationDir, getServiceManager, getServiceName, getServiceTempDir, isEnabled, isServiceMonitored, makeAbsoluteFileMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
-
Constructor Details
-
PerformanceInterceptorServiceImpl
public PerformanceInterceptorServiceImpl()Constructor
-
-
Method Details
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
configurein interfaceorg.apache.avalon.framework.configuration.Configurable- Overrides:
configurein classBaseInterceptorServiceImpl- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
reconfigure
public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
reconfigurein interfaceorg.apache.avalon.framework.configuration.Reconfigurable- Overrides:
reconfigurein classBaseInterceptorServiceImpl- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
onEntry
Description copied from interface:AvalonInterceptorServiceCalled before a service method is invoked.- Specified by:
onEntryin interfaceAvalonInterceptorService- Overrides:
onEntryin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor context- See Also:
-
onError
Description copied from interface:AvalonInterceptorServiceCalled when a service method throws an exeption- Specified by:
onErrorin interfaceAvalonInterceptorService- Overrides:
onErrorin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor contextt- the resulting exception- See Also:
-
onExit
Description copied from interface:AvalonInterceptorServiceCalled after a service method was invoked.- Specified by:
onExitin interfaceAvalonInterceptorService- Overrides:
onExitin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor contextresult- the result of the invocation- See Also:
-
createStopWatch
Creates a stop watch- Parameters:
interceptorContext- the current interceptor context
-
getStopWatch
Gets the stop watch- Parameters:
interceptorContext- the current interceptor context- Returns:
- the stop watch
-
log
Logs the execution time.- Parameters:
mode- the invocation mode (onEntry, onExit, onError)interceptorContext- the current interceptor contextstopWatch- the stop watch
-
toString
protected String toString(AvalonInterceptorContext interceptorContext, StopWatch stopWatch, int mode) Create the log message for the performance logfile.- Parameters:
interceptorContext- the contextstopWatch- the stopwatchmode- the mode (onEntry, onExit, onError)- Returns:
- the log message
-
toString
Prints the argument list.- Parameters:
args- array of arguments- Returns:
- the debug output
-