org.objectweb.fractal.jmx.julia.stat
Class BasicStatController

java.lang.Object
  extended byorg.objectweb.fractal.jmx.julia.stat.BasicStatController
All Implemented Interfaces:
Initializable, StatController
Direct Known Subclasses:
ExponentialSmoothingStatController

public class BasicStatController
extends Object
implements StatController, Initializable

Simple implementation of StatController.

Version:
0.1

Field Summary
protected  long _period
          The minimal time interval used for rate re-computation, in milliseconds (default value is 5000).
 
Constructor Summary
BasicStatController()
           
 
Method Summary
 int getNumberOfMethodCall()
          Gets the number of method calls.
 int getNumberOfMethodSuccess()
          Gets the number of method calls that have "succeded".
 double getRateOfMethodCall()
          Gets the rate of method calls.
 double getRateOfMethodSuccess()
          Gets the rate of method calls that have "succeded".
 void initialize(Tree args)
          Initializes this object with the given arguments.
 void reset()
          Resets (to zero) the values returned by this controller.
 void statPostMethod(String method)
          A postMethod called by the associated interceptor.
 void statPreMethod(String method)
          A preMethod called by the associated interceptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_period

protected long _period
The minimal time interval used for rate re-computation, in milliseconds (default value is 5000).

Its value must be positive and can be fixed by initialize.

Constructor Detail

BasicStatController

public BasicStatController()
Method Detail

initialize

public void initialize(Tree args)
Initializes this object with the given arguments. The first subtree (if any) must represent the value of period.

Specified by:
initialize in interface Initializable
Parameters:
args - the arguments to be used to initialize this object.
Throws:
NumberFormatException - if the first subtree is not a valid string representation of a long value.
IllegalStateException - if the firts subtree does not represent a positive value.

reset

public void reset()
Description copied from interface: StatController
Resets (to zero) the values returned by this controller.

Specified by:
reset in interface StatController

getNumberOfMethodCall

public int getNumberOfMethodCall()
Description copied from interface: StatController
Gets the number of method calls.

Specified by:
getNumberOfMethodCall in interface StatController
Returns:
the number of method calls that have been made on the server interfaces of the component (control interfaces excluded).

getNumberOfMethodSuccess

public int getNumberOfMethodSuccess()
Description copied from interface: StatController
Gets the number of method calls that have "succeded".

Specified by:
getNumberOfMethodSuccess in interface StatController
Returns:
the number of method calls that have been made on the server interfaces of the component (control interfaces excluded), and that have "succeded", i.e., that have not thrown an exception.

getRateOfMethodCall

public double getRateOfMethodCall()
Description copied from interface: StatController
Gets the rate of method calls.

Specified by:
getRateOfMethodCall in interface StatController
Returns:
the rate of method calls (number / second) that have been made on the server interfaces of the component (control interfaces excluded).

getRateOfMethodSuccess

public double getRateOfMethodSuccess()
Description copied from interface: StatController
Gets the rate of method calls that have "succeded".

Specified by:
getRateOfMethodSuccess in interface StatController
Returns:
the rate of method calls (number / second) that have been made on the server interfaces of the component (control interfaces excluded), and that have "succeded", i.e., that have not thrown an exception.

statPreMethod

public void statPreMethod(String method)
A preMethod called by the associated interceptor. This preMethod increments the number of method calls that have been made on the server interfaces of the component (control interfaces excluded).

Parameters:
method - the method that is intercepted.

statPostMethod

public void statPostMethod(String method)
A postMethod called by the associated interceptor. Since postMethod is not called inside a finally block - see StatCodeGenerator - it is not called if the intercepted method throws an exception.

This postMethod increments the number of method calls that have been made on the server interfaces of the component (control interfaces excluded), and that have "succeded", i.e., that have not thrown an exception.

Parameters:
method - the method that is intercepted.