jfun.yan.monitoring
Interface MethodMonitor

All Known Subinterfaces:
ComponentMonitor
All Known Implementing Classes:
NopComponentMonitor

public interface MethodMonitor

This interface represents something that monitors the invocation of a method.

Author:
Michelle Lei

Method Summary
 void invocationFailed(java.lang.Object obj, java.lang.reflect.Method mtd, java.lang.Object[] args, java.lang.Throwable err, long duration)
          This method is called after the target method failed.
 void invoked(java.lang.Object obj, java.lang.reflect.Method mtd, java.lang.Object[] args, java.lang.Object result, long duration)
          This method is called after the target method is successfully executed.
 void invoking(java.lang.Object obj, java.lang.reflect.Method mtd, java.lang.Object[] args)
          This method is called right before the target method is invoked.
 

Method Detail

invoking

void invoking(java.lang.Object obj,
              java.lang.reflect.Method mtd,
              java.lang.Object[] args)
This method is called right before the target method is invoked.

Parameters:
obj - the object to which the target method belongs.
mtd - the target method.
args - the arguments passed to the target method.

invoked

void invoked(java.lang.Object obj,
             java.lang.reflect.Method mtd,
             java.lang.Object[] args,
             java.lang.Object result,
             long duration)
This method is called after the target method is successfully executed.

Parameters:
obj - the object to which the target method belongs.
mtd - the target method.
args - the arguments passed to the target method.
result - the return value from the target method.
duration - exactly how long it took to execute the target method. (in milliseconds)

invocationFailed

void invocationFailed(java.lang.Object obj,
                      java.lang.reflect.Method mtd,
                      java.lang.Object[] args,
                      java.lang.Throwable err,
                      long duration)
This method is called after the target method failed.

Parameters:
obj - the object to which the target method belongs.
mtd - the target method.
args - the arguments passed to the target method.
err - the exception thrown out from the target method.
duration - exactly how long it took to execute the target method. (in milliseconds)