com.sun.slamd.loadvariance
Class LoadVarianceAlgorithm

java.lang.Object
  extended bycom.sun.slamd.loadvariance.LoadVarianceAlgorithm
Direct Known Subclasses:
LinearLoadVarianceAlgorithm, SineLoadVarianceAlgorithm, StairStepLoadVarianceAlgorithm

public abstract class LoadVarianceAlgorithm
extends java.lang.Object

This class defines an abstract algorithm that may be used to vary the load over time while a job is running by controlling the number of threads that are active at any given time. Actual subclasses must implement any abstract methods defined in this class.


Constructor Summary
LoadVarianceAlgorithm()
          This constructor is used to create a new instance of this load variation algorithm through reflection.
 
Method Summary
abstract  int[][] calculateVariance(int duration, int totalThreads, int activeThreads)
          Retrieves a two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time.
abstract  void initializeVariationAlgorithm(java.lang.String[] arguments)
          Initializes this load variation algorithm based on the provided list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadVarianceAlgorithm

public LoadVarianceAlgorithm()
This constructor is used to create a new instance of this load variation algorithm through reflection. A default constructor must be provided in all subclasses, but the only thing that it needs to do is call super().

Method Detail

initializeVariationAlgorithm

public abstract void initializeVariationAlgorithm(java.lang.String[] arguments)
                                           throws SLAMDException
Initializes this load variation algorithm based on the provided list of arguments.

Parameters:
arguments - The arguments that may be used to customize the behavior of this load variation algorithm.
Throws:
SLAMDException - If a problem occurs while trying to initialize this load variation algorithm.

calculateVariance

public abstract int[][] calculateVariance(int duration,
                                          int totalThreads,
                                          int activeThreads)
                                   throws SLAMDException
Retrieves a two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time. Each element of the array returned should itself be a two-element array with the first element being the number of milliseconds since the start of this load variance instruction that the increase or decrease should occur, and the second is an integer value that indicates the number of threads that should be added at that time (may be negative if threads are to be removed).

Parameters:
duration - The length of time in seconds over which this load variance algorithm should operate.
totalThreads - The total number of threads that have been scheduled for the job with which this algorithm is to be used.
activeThreads - The number of threads that are already active at the time that this method is called.
Returns:
A two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time.
Throws:
SLAMDException