org.javasimon.spring
Class SpringStopwatchSource

java.lang.Object
  extended by org.javasimon.source.AbstractStopwatchSource<T>
      extended by org.javasimon.source.AbstractMethodStopwatchSource<org.aopalliance.intercept.MethodInvocation>
          extended by org.javasimon.spring.SpringStopwatchSource
All Implemented Interfaces:
MonitorSource<org.aopalliance.intercept.MethodInvocation,Stopwatch>, StopwatchSource<org.aopalliance.intercept.MethodInvocation>

public class SpringStopwatchSource
extends AbstractMethodStopwatchSource<org.aopalliance.intercept.MethodInvocation>

Monitor source providing stopwatches from Spring AOP method invocation.

Author:
gquintana

Constructor Summary
SpringStopwatchSource(Manager manager)
          Constructor with specified Manager.
 
Method Summary
protected  String getMeaningfulClassName(Class<?> targetClass)
           
protected  String getMonitorName(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Returns monitor name for the given method invocation with Monitored.name() and Monitored.suffix() applied as expected.
protected  Class<?> getTargetClass(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Get target class.
protected  Method getTargetMethod(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Get method being invoked.
 boolean isMonitored(org.aopalliance.intercept.MethodInvocation methodInvocation)
          By default returns true because it is expected to be called from MonitoringInterceptor which means that the method call should be monitored.
 
Methods inherited from class org.javasimon.source.AbstractMethodStopwatchSource
cache, getMonitor, newCacheStopwatchSource
 
Methods inherited from class org.javasimon.source.AbstractStopwatchSource
getManager, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringStopwatchSource

public SpringStopwatchSource(Manager manager)
Constructor with specified Manager.

Parameters:
manager - Simon manager used for producing Stopwatches
Method Detail

getTargetClass

protected final Class<?> getTargetClass(org.aopalliance.intercept.MethodInvocation methodInvocation)
Get target class.

Specified by:
getTargetClass in class AbstractMethodStopwatchSource<org.aopalliance.intercept.MethodInvocation>

getTargetMethod

protected Method getTargetMethod(org.aopalliance.intercept.MethodInvocation methodInvocation)
Get method being invoked.

Specified by:
getTargetMethod in class AbstractMethodStopwatchSource<org.aopalliance.intercept.MethodInvocation>
Parameters:
methodInvocation - Method invocation
Returns:
Method being invoked

isMonitored

public boolean isMonitored(org.aopalliance.intercept.MethodInvocation methodInvocation)
By default returns true because it is expected to be called from MonitoringInterceptor which means that the method call should be monitored. Pointcuts provided enough mechanism to decide whether the method is monitored or not, but this method can be overridden if needed.

Specified by:
isMonitored in interface MonitorSource<org.aopalliance.intercept.MethodInvocation,Stopwatch>
Overrides:
isMonitored in class AbstractStopwatchSource<org.aopalliance.intercept.MethodInvocation>
Parameters:
methodInvocation - current method invocation
Returns:
true, if the method invocation should be monitored

getMonitorName

protected String getMonitorName(org.aopalliance.intercept.MethodInvocation methodInvocation)
Returns monitor name for the given method invocation with Monitored.name() and Monitored.suffix() applied as expected.

Specified by:
getMonitorName in class AbstractStopwatchSource<org.aopalliance.intercept.MethodInvocation>
Parameters:
methodInvocation - current method invocation
Returns:
name of the Stopwatch for the invocation

getMeaningfulClassName

protected String getMeaningfulClassName(Class<?> targetClass)


Copyright © 2013. All Rights Reserved.