KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > monitoring > MethodMonitor


1 package jfun.yan.monitoring;
2
3 import java.lang.reflect.Method JavaDoc;
4 /**
5  * <p>
6  * This interface represents something that monitors the invocation of a method.
7  * </p>
8  * @author Michelle Lei
9  *
10  */

11 public interface MethodMonitor {
12   /**
13    * This method is called right before the target method is invoked.
14    * @param obj the object to which the target method belongs.
15    * @param mtd the target method.
16    * @param args the arguments passed to the target method.
17    */

18   void invoking(Object JavaDoc obj, Method JavaDoc mtd, Object JavaDoc[] args);
19   /**
20    * This method is called after the target method is successfully executed.
21    * @param obj the object to which the target method belongs.
22    * @param mtd the target method.
23    * @param args the arguments passed to the target method.
24    * @param result the return value from the target method.
25    * @param duration exactly how long it took to execute the target method. (in milliseconds)
26    */

27   void invoked(Object JavaDoc obj, Method JavaDoc mtd, Object JavaDoc[] args, Object JavaDoc result, long duration);
28   /**
29    * This method is called after the target method failed.
30    * @param obj the object to which the target method belongs.
31    * @param mtd the target method.
32    * @param args the arguments passed to the target method.
33    * @param err the exception thrown out from the target method.
34    * @param duration exactly how long it took to execute the target method. (in milliseconds)
35    */

36   void invocationFailed(Object JavaDoc obj, Method JavaDoc mtd, Object JavaDoc[] args, Throwable JavaDoc err, long duration);
37 }
38
Popular Tags