Class JamonInterceptorServiceImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
org.apache.fulcrum.yaafi.interceptor.jamon.JamonInterceptorServiceImpl
- All Implemented Interfaces:
Runnable
,org.apache.avalon.framework.activity.Disposable
,org.apache.avalon.framework.activity.Initializable
,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
,JamonInterceptorService
public class JamonInterceptorServiceImpl
extends BaseInterceptorServiceImpl
implements JamonInterceptorService, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable
A service using JAMon for performance monitoring. The implementation relies
on reflection to invoke JAMON to avoid compile-time coupling.
- 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 TypeMethodDescriptionvoid
configure
(org.apache.avalon.framework.configuration.Configuration configuration) protected JamonPerformanceMonitor
createJamonPerformanceMonitor
(String serviceName, Method method, boolean isEnabled) Factory method for creating an implementation of a JamonPerformanceMonitor.void
dispose()
void
protected final boolean
void
onEntry
(AvalonInterceptorContext interceptorContext) Called before a service method is invoked.void
onError
(AvalonInterceptorContext interceptorContext, Throwable t) Called when a service method throws an exeptionvoid
onExit
(AvalonInterceptorContext interceptorContext, Object result) Called after a service method was invoked.void
reconfigure
(org.apache.avalon.framework.configuration.Configuration configuration) void
run()
Writes the JAMON report to the file system.protected void
Write a report fileprotected void
writeReport
(File reportFile) Write the HTML report to the given destination.Methods inherited from class org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
contextualize, getClassLoader, getServiceApplicationDir, getServiceManager, getServiceName, getServiceTempDir, isEnabled, isServiceMonitored, makeAbsoluteFile
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
JamonInterceptorServiceImpl
public JamonInterceptorServiceImpl()Constructor
-
-
Method Details
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
configure
in interfaceorg.apache.avalon.framework.configuration.Configurable
- Overrides:
configure
in classBaseInterceptorServiceImpl
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
- See Also:
-
initialize
- Specified by:
initialize
in interfaceorg.apache.avalon.framework.activity.Initializable
- Throws:
Exception
- See Also:
-
reconfigure
public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
reconfigure
in interfaceorg.apache.avalon.framework.configuration.Reconfigurable
- Overrides:
reconfigure
in classBaseInterceptorServiceImpl
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
- See Also:
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.apache.avalon.framework.activity.Disposable
- See Also:
-
onEntry
Description copied from interface:AvalonInterceptorService
Called before a service method is invoked.- Specified by:
onEntry
in interfaceAvalonInterceptorService
- Overrides:
onEntry
in classBaseInterceptorServiceImpl
- Parameters:
interceptorContext
- shared interceptor context- See Also:
-
onExit
Description copied from interface:AvalonInterceptorService
Called after a service method was invoked.- Specified by:
onExit
in interfaceAvalonInterceptorService
- Overrides:
onExit
in classBaseInterceptorServiceImpl
- Parameters:
interceptorContext
- shared interceptor contextresult
- the result of the invocation- See Also:
-
onError
Description copied from interface:AvalonInterceptorService
Called when a service method throws an exeption- Specified by:
onError
in interfaceAvalonInterceptorService
- Overrides:
onError
in classBaseInterceptorServiceImpl
- Parameters:
interceptorContext
- shared interceptor contextt
- the resulting exception- See Also:
-
run
public void run()Writes the JAMON report to the file system. -
isJamonAvailable
protected final boolean isJamonAvailable()- Returns:
- Returns true if JAMon is availble.
-
createJamonPerformanceMonitor
protected JamonPerformanceMonitor createJamonPerformanceMonitor(String serviceName, Method method, boolean isEnabled) Factory method for creating an implementation of a JamonPerformanceMonitor.- Parameters:
serviceName
- the service namemethod
- the methodisEnabled
- is the monitor enabled- Returns:
- the instance or null if the creation failed
-
writeReport
protected void writeReport()Write a report file -
writeReport
Write the HTML report to the given destination.- Parameters:
reportFile
- the report destination
-