Class MethodExecStats

java.lang.Object
org.apache.juneau.rest.stats.MethodExecStats

public class MethodExecStats extends Object
Method execution statistics. Keeps track of number of starts/finishes on tasks and keeps an average run time.
See Also:
  • Constructor Details

  • Method Details

    • create

      public static MethodExecStats.Builder create(BeanStore beanStore)
      Static creator.
      Parameters:
      beanStore - The bean store to use for creating beans.
      Returns:
      A new builder for this object.
    • started

      Call when task is started.
      Returns:
      This object.
    • finished

      public MethodExecStats finished(long nanoTime)
      Call when task is finished.
      Parameters:
      nanoTime - The execution time of the task in nanoseconds.
      Returns:
      This object.
    • error

      Call when an error occurs.
      Parameters:
      e - The exception thrown. Can be null.
      Returns:
      This object.
    • getGuid

      public long getGuid()
      Returns a globally unique ID for this object.

      A random long generated during the creation of this object. Allows this object to be differentiated from other similar objects in multi-node environments so that statistics can be reliably stored in a centralized location.

      Returns:
      The globally unique ID for this object.
    • getMethod

      public Method getMethod()
      Returns the method name of these stats.
      Returns:
      The method name of these stats.
    • getRuns

      public int getRuns()
      Returns the number of times the started() method was called.
      Returns:
      The number of times the started() method was called.
    • getRunning

      public int getRunning()
      Returns the number currently running method invocations.
      Returns:
      The number of currently running method invocations.
    • getErrors

      public int getErrors()
      Returns the number of times the error(Throwable) method was called.
      Returns:
      The number of times the error(Throwable) method was called.
    • getMinTime

      public int getMinTime()
      Returns the max execution time.
      Returns:
      The average execution time in milliseconds.
    • getMaxTime

      public int getMaxTime()
      Returns the max execution time.
      Returns:
      The average execution time in milliseconds.
    • getAvgTime

      public int getAvgTime()
      Returns the average execution time.
      Returns:
      The average execution time in milliseconds.
    • getTotalTime

      public long getTotalTime()
      Returns the total execution time.
      Returns:
      The total execution time in milliseconds.
    • getThrownStore

      Returns information on all stack traces of all exceptions encountered.
      Returns:
      Information on all stack traces of all exceptions encountered.
    • toString

      public String toString()
      Overrides:
      toString in class Object