|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.perf4j.aop.AbstractTimingAspect
public abstract class AbstractTimingAspect
This is the base class for TimingAspects. 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.
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 String |
evaluateJexl(String text,
Object[] args,
Object annotatedObject,
Object returnValue,
Throwable exceptionThrown)
Helper method is used to parse out {expressionLanguage} elements from the text and evaluate the strings using JEXL. |
protected org.apache.commons.jexl.Expression |
getJexlExpression(String expressionText)
Helper method gets a compiled JEXL expression for the specified expression text, either from the cache or by creating a new compiled expression. |
protected String |
getStopWatchMessage(Profiled profiled,
org.aspectj.lang.ProceedingJoinPoint pjp,
Object returnValue,
Throwable exceptionThrown)
Helper method get the message to use for StopWatch logging. |
protected String |
getStopWatchTag(Profiled profiled,
org.aspectj.lang.ProceedingJoinPoint pjp,
Object returnValue,
Throwable exceptionThrown)
Helper method gets the tag to use for StopWatch logging. |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTimingAspect()
Method Detail |
---|
public Object doPerfLogging(org.aspectj.lang.ProceedingJoinPoint pjp, Profiled profiled) throws Throwable
pjp
- The ProceedingJoinPoint encapulates the method around which this aspect advice runs.profiled
- The profiled annotation that was attached to the method.
Throwable
- Any exceptions thrown by the underlying method.protected String getStopWatchTag(Profiled profiled, org.aspectj.lang.ProceedingJoinPoint pjp, Object returnValue, Throwable exceptionThrown)
profiled
- The profiled annotation that was attached to the method.pjp
- The ProceedingJoinPoint encapulates the method around which this aspect advice runs.returnValue
- The value returned from the execution of the profiled method, or null if the method
returned void or an exception was thrown.exceptionThrown
- The exception thrown, if any, by the profiled method. Will be null if the method
completed normally.
protected String getStopWatchMessage(Profiled profiled, org.aspectj.lang.ProceedingJoinPoint pjp, Object returnValue, Throwable exceptionThrown)
profiled
- The profiled annotation that was attached to the method.pjp
- The ProceedingJoinPoint encapulates the method around which this aspect advice runs.returnValue
- The value returned from the execution of the profiled method, or null if the method
returned void or an exception was thrown.exceptionThrown
- The exception thrown, if any, by the profiled method. Will be null if the method
completed normally.
protected String evaluateJexl(String text, Object[] args, Object annotatedObject, Object returnValue, Throwable exceptionThrown)
text
- The text to be parsed.args
- The args that were passed to the method to be profiled.annotatedObject
- The value of the object whose method was profiled. Will be null if a class method was
profiled.returnValue
- The value returned from the execution of the profiled method, or null if the method
returned void or an exception was thrown.exceptionThrown
- The exception thrown, if any, by the profiled method. Will be null if the method
completed normally.
Profiled.el()
protected org.apache.commons.jexl.Expression getJexlExpression(String expressionText) throws Exception
expressionText
- The JEXL expression text
Exception
- Thrown if there was an error compiling the expression textprotected abstract LoggingStopWatch newStopWatch(String loggerName, String levelName)
loggerName
- The name of the logger to use for persisting StopWatch messages.levelName
- The level at which the message should be logged.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |