org.perf4j.aop
Class AbstractTimingAspect

java.lang.Object
  extended by org.perf4j.aop.AgnosticTimingAspect
      extended by org.perf4j.aop.AbstractTimingAspect
Direct Known Subclasses:
TimingAspect, TimingAspect, TimingAspect, TimingAspect

public abstract class AbstractTimingAspect
extends AgnosticTimingAspect

This is the base class for TimingAspects that use the AspectJ framework (a better name for this class work probably be AspectJTimingAspect, but for backwards compatibility reasons it keeps the AbstractTimingAspect name). Subclasses just need to implement the newStopWatch(java.lang.String, java.lang.String) method to use their logging framework of choice (e.g. log4j or java.logging) to persist the StopWatch log message.

Author:
Alex Devine

Constructor Summary
AbstractTimingAspect()
           
 
Method Summary
 Object doPerfLogging(org.aspectj.lang.ProceedingJoinPoint pjp, Profiled profiled)
          This advice is used to add the StopWatch logging statements around method executions that have been tagged with the Profiled annotation.
protected abstract  LoggingStopWatch newStopWatch(String loggerName, String levelName)
          Subclasses should implement this method to return a LoggingStopWatch that should be used to time the wrapped code block.
 
Methods inherited from class org.perf4j.aop.AgnosticTimingAspect
evaluateJexl, getJexlExpression, getStopWatchMessage, getStopWatchTag, runProfiledMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTimingAspect

public AbstractTimingAspect()
Method Detail

doPerfLogging

public Object doPerfLogging(org.aspectj.lang.ProceedingJoinPoint pjp,
                            Profiled profiled)
                     throws Throwable
This advice is used to add the StopWatch logging statements around method executions that have been tagged with the Profiled annotation.

Parameters:
pjp - The ProceedingJoinPoint encapulates the method around which this aspect advice runs.
profiled - The profiled annotation that was attached to the method.
Returns:
The return value from the method that was executed.
Throws:
Throwable - Any exceptions thrown by the underlying method.

newStopWatch

protected abstract LoggingStopWatch newStopWatch(String loggerName,
                                                 String levelName)
Subclasses should implement this method to return a LoggingStopWatch that should be used to time the wrapped code block.

Parameters:
loggerName - The name of the logger to use for persisting StopWatch messages.
levelName - The level at which the message should be logged.
Returns:
The new LoggingStopWatch.


Copyright © 2008-2011 perf4j.org. All Rights Reserved.