Package org.jppf.load.balancer
Class PerformanceCache
java.lang.Object
org.jppf.load.balancer.PerformanceCache
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionPerformanceCache(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 TypeMethodDescriptionvoidaddSample(PerformanceSample sample) Add the specified performance sample to the list of samples.voidclear()Remove all entries in the performance samples list.doublegetMean()Get the computed mean execution time for the corresponding node.longGet the current number of samples.doubleGet the previously computed mean execution time for the corresponding node.intgetSize()Get the number of samples required to compute the moving average.voidsetMean(double mean) Get the computed mean execution time for the corresponding node.voidsetSize(int size) Set the maximum number fo samples.toString()
-
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
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
-