org.javasimon.source
Class AbstractMethodStopwatchSource<T>

java.lang.Object
  extended by org.javasimon.source.AbstractStopwatchSource<T>
      extended by org.javasimon.source.AbstractMethodStopwatchSource<T>
All Implemented Interfaces:
MonitorSource<T,Stopwatch>, StopwatchSource<T>
Direct Known Subclasses:
ProxyStopwatchSource

public abstract class AbstractMethodStopwatchSource<T>
extends AbstractStopwatchSource<T>

Base class for Stopwatch sources working on method locations.

Author:
gquintana

Constructor Summary
AbstractMethodStopwatchSource(Manager manager)
          Constructor using specific simon manager.
 
Method Summary
 CachedStopwatchSource<T,Method> cache()
          Wraps this data source in a cache.
 Stopwatch getMonitor(T location)
          Returns the Stopwatch for given join point.
protected abstract  Class<?> getTargetClass(T location)
          Get target class from location.
protected abstract  Method getTargetMethod(T location)
          Get target method from location.
static
<T> CachedStopwatchSource<T,Method>
newCacheStopwatchSource(AbstractMethodStopwatchSource<T> stopwatchSource)
          Wraps given stopwatch source in a cache.
 
Methods inherited from class org.javasimon.source.AbstractStopwatchSource
getManager, getMonitorName, isMonitored, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMethodStopwatchSource

public AbstractMethodStopwatchSource(Manager manager)
Constructor using specific simon manager.

Parameters:
manager - Simon manager
Method Detail

getTargetClass

protected abstract Class<?> getTargetClass(T location)
Get target class from location.

Parameters:
location - Location
Returns:
Target class

getTargetMethod

protected abstract Method getTargetMethod(T location)
Get target method from location.

Parameters:
location - Location
Returns:
Target method

getMonitor

public Stopwatch getMonitor(T location)
Returns the Stopwatch for given join point.

Specified by:
getMonitor in interface MonitorSource<T,Stopwatch>
Overrides:
getMonitor in class AbstractStopwatchSource<T>
Parameters:
location - Location
Returns:
Stopwatch

newCacheStopwatchSource

public static <T> CachedStopwatchSource<T,Method> newCacheStopwatchSource(AbstractMethodStopwatchSource<T> stopwatchSource)
Wraps given stopwatch source in a cache.

Parameters:
stopwatchSource - Stopwatch source
Returns:
Cached stopwatch source

cache

public CachedStopwatchSource<T,Method> cache()
Wraps this data source in a cache.

Returns:
Cache monitor source


Copyright © 2013. All Rights Reserved.