Class PerformanceCache

java.lang.Object
org.jppf.load.balancer.PerformanceCache
All Implemented Interfaces:
Serializable

public class PerformanceCache extends Object implements Serializable
Each instance of this class acts as a container for the performance data related to a node.
Author:
Laurent Cohen
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    PerformanceCache(int size)
    Initialize this data holder with the maximum number of samples in the performance cache.
    PerformanceCache(int size, double mean)
    Initialize this data holder with the maximum number of samples in the performance cache, and initial mean execution time.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add the specified performance sample to the list of samples.
    void
    Remove all entries in the performance samples list.
    double
    Get the computed mean execution time for the corresponding node.
    long
    Get the current number of samples.
    double
    Get the previously computed mean execution time for the corresponding node.
    int
    Get the number of samples required to compute the moving average.
    void
    setMean(double mean)
    Get the computed mean execution time for the corresponding node.
    void
    setSize(int size)
    Set the maximum number fo samples.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PerformanceCache

      public PerformanceCache(int size)
      Initialize this data holder with the maximum number of samples in the performance cache.
      Parameters:
      size - the number of samples as an int.
    • PerformanceCache

      public PerformanceCache(int size, double mean)
      Initialize this data holder with the maximum number of samples in the performance cache, and initial mean execution time.
      Parameters:
      size - the number of samples as an int.
      mean - the initial mean execution time.
  • Method Details

    • addSample

      public void addSample(PerformanceSample sample)
      Add the specified performance sample to the list of samples.
      Parameters:
      sample - the performance sample to add.
    • getMean

      public double getMean()
      Get the computed mean execution time for the corresponding node.
      Returns:
      the mean value as a double.
    • setMean

      public void setMean(double mean)
      Get the computed mean execution time for the corresponding node.
      Parameters:
      mean - the mean value as a double.
    • getPreviousMean

      public double getPreviousMean()
      Get the previously computed mean execution time for the corresponding node.
      Returns:
      the previous mean value as a double.
    • getSize

      public int getSize()
      Get the number of samples required to compute the moving average.
      Returns:
      the number of samples as an int.
    • setSize

      public void setSize(int size)
      Set the maximum number fo samples.
      Parameters:
      size - the new maximum number of samples.
    • getNbSamples

      public long getNbSamples()
      Get the current number of samples.
      Returns:
      the number of samples as an int.
    • clear

      public void clear()
      Remove all entries in the performance samples list.
    • toString

      public String toString()
      Overrides:
      toString in class Object