KickJava   Java API By Example, From Geeks To Geeks.

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


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

11 public interface FunctionMonitor {
12   /**
13    * This method is called right before the function is called.
14    * @param f the function to be called.
15    * @param args the arguments passed to the function.
16    */

17   void calling(Function f, Object JavaDoc[] args);
18   /**
19    * This method is called right after the function is called successfully.
20    * @param f the function.
21    * @param args the arguments passed to the function.
22    * @param result the value returned by the function.
23    * @param duration excactly how long the function call takes. (in milliseconds)
24    */

25   void called(Function f, Object JavaDoc[] args, Object JavaDoc result, long duration);
26   /**
27    * This method is called after the function failed.
28    * @param f the function.
29    * @param args the arguments passed to the function.
30    * @param err the exception thrown out of the function.
31    * @param duration exactly how long the function call takes. (in milliseconds)
32    */

33   void callFailed(Function f, Object JavaDoc[] args, Throwable JavaDoc err, long duration);
34 }
35
Popular Tags