org.jmonit.support.aop
Class PerformanceInterceptor

java.lang.Object
  extended by org.jmonit.support.aop.PerformanceInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class PerformanceInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor

AOP-alliance interceptor to evaluate component performances using an intercpetor. Typically used with spring-aop.

Author:
Nicolas De Loof

Constructor Summary
PerformanceInterceptor()
           
 
Method Summary
protected  Monitor getFailureMonitor(Monitor monitor, java.lang.Throwable error)
          Select a monitor for method invocation failures.
protected  java.lang.String getMonitorName(org.aopalliance.intercept.MethodInvocation invocation)
          Compute the monitor name associated to this mehod invocation
protected  Repository getRepository()
          Get the current repository
protected  Monitor getSuccessMonitor(Monitor monitor)
          Select a monitor for successful method invocations.
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
          
 void setRepository(Repository repository)
          Set a custom application-defined repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceInterceptor

public PerformanceInterceptor()
Method Detail

invoke

public final java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                              throws java.lang.Throwable

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable
See Also:
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)

getSuccessMonitor

protected Monitor getSuccessMonitor(Monitor monitor)
Select a monitor for successful method invocations. Application can override this method for custom usage.

Parameters:
monitor - the monitor associated to this mehod invocation
Returns:
a monitor, or null if no monitoring is expected

getFailureMonitor

protected Monitor getFailureMonitor(Monitor monitor,
                                    java.lang.Throwable error)
Select a monitor for method invocation failures. Application can override this method for custom usage.

Parameters:
monitor - the monitor associated to this mehod invocation
Returns:
a monitor, or null if no monitoring is expected

getMonitorName

protected java.lang.String getMonitorName(org.aopalliance.intercept.MethodInvocation invocation)
Compute the monitor name associated to this mehod invocation

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

setRepository

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

Parameters:
repository -

getRepository

protected Repository getRepository()
Get the current repository

Returns:


Copyright © 2007 Nicolas De Loof. All Rights Reserved.