org.apache.commons.monitoring.aop
Class AbstractPerformanceInterceptor<T>

java.lang.Object
  extended by org.apache.commons.monitoring.aop.AbstractPerformanceInterceptor<T>
Direct Known Subclasses:
AopPerformanceInterceptor, CommonsProxyPerformanceInterceptor

public abstract class AbstractPerformanceInterceptor<T>
extends java.lang.Object

A method interceptor that compute method invocation performances.

Concrete implementation will adapt the method interception API to this class requirement.

Author:
Nicolas De Loof

Field Summary
protected  java.lang.String category
           
protected  MonitorNameExtractor monitorNameExtractor
           
protected  Repository repository
           
protected  java.lang.String subsystem
           
 
Constructor Summary
AbstractPerformanceInterceptor()
           
 
Method Summary
protected  void beforeReturning(Monitor monitor, java.lang.Throwable error, long duration)
           
protected  java.lang.Object doInvoke(T invocation)
          API neutral method invocation
protected  java.lang.String getMonitorName(java.lang.reflect.Method method)
          Compute the monitor name associated to this method invocation
protected abstract  java.lang.String getMonitorName(T invocation)
           
protected abstract  java.lang.Object proceed(T invocation)
           
 void setCategory(java.lang.String category)
           
 void setMonitorNameExtractor(MonitorNameExtractor monitorNameExtractor)
           
 void setRepository(Repository repository)
          Set a custom application-defined repository
 void setSubsystem(java.lang.String subsystem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repository

protected Repository repository

category

protected java.lang.String category

subsystem

protected java.lang.String subsystem

monitorNameExtractor

protected MonitorNameExtractor monitorNameExtractor
Constructor Detail

AbstractPerformanceInterceptor

public AbstractPerformanceInterceptor()
Method Detail

doInvoke

protected java.lang.Object doInvoke(T invocation)
                             throws java.lang.Throwable
API neutral method invocation

Throws:
java.lang.Throwable

proceed

protected abstract java.lang.Object proceed(T invocation)
                                     throws java.lang.Throwable
Parameters:
invocation -
Returns:
Throws:
java.lang.Throwable

getMonitorName

protected abstract java.lang.String getMonitorName(T invocation)
Parameters:
invocation -
Returns:

getMonitorName

protected java.lang.String getMonitorName(java.lang.reflect.Method method)
Compute the monitor name associated to this method invocation

Parameters:
method - method being invoked
Returns:
monitor name. If null, nothing will be monitored

beforeReturning

protected void beforeReturning(Monitor monitor,
                               java.lang.Throwable error,
                               long duration)
Parameters:
monitor - the monitor associated to the method invocation
error - Throwable thrown by the method invocation if any
duration - the duration of the method invocation

setRepository

public void setRepository(Repository repository)
Set a custom application-defined repository

Parameters:
repository -

setCategory

public void setCategory(java.lang.String category)

setSubsystem

public void setSubsystem(java.lang.String subsystem)

setMonitorNameExtractor

public void setMonitorNameExtractor(MonitorNameExtractor monitorNameExtractor)
Parameters:
monitorNameExtractor - the monitorNameExtractor to set


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.