com.sun.slamd.server
Class RealTimeJobStats

java.lang.Object
  extended bycom.sun.slamd.server.RealTimeJobStats

public class RealTimeJobStats
extends java.lang.Object

This class defines a data type that will be used to hold real-time stat data for a particular job. Note that this class is not thread safe, so it is assumed that whatever is using it performs adequate locking to ensure proper safety.


Constructor Summary
RealTimeJobStats(RealTimeStatHandler statHandler, java.lang.String jobID, int maxIntervals)
          Creates a new stat data handler for the specified job.
 
Method Summary
 void deregisterStatistic()
          Deregisters a stat reporder from this stat handler.
 int getFirstInterval(java.lang.String statName)
          Retrieves the interval number of the first interval available for the specified statistic.
 Job getJob()
          Retrieves the job with which this handler is associated.
 java.lang.String getJobID()
          Retrieves the job ID with which this handler is associated.
 long getLastUpdateTime()
          Retrieves the time that this data was last updated.
 java.lang.String[] getStatNames()
          Retrieves the display names of the statistics that are available in this stat handler.
 double[] getStatValues(java.lang.String statName)
          Retrieves the data currently available for the specified statistic.
 void registerStatistic(java.lang.String statName)
          Registers the specified statistic with this stat handler.
 void setLastUpdateTime()
          Indicates that the lastUpdateTime should be set to the current time.
 void updateStatToAdd(java.lang.String statName, int intervalNumber, double value)
          Updates the data for the specified statistic to indicate that the provided value should be added to the existing data for the specified interval.
 void updateStatToAverage(java.lang.String statName, int intervalNumber, double value)
          Updates the data for the specified statistic to indicate that the provided value should be averaged with the existing data for the specified interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealTimeJobStats

public RealTimeJobStats(RealTimeStatHandler statHandler,
                        java.lang.String jobID,
                        int maxIntervals)
                 throws SLAMDServerException
Creates a new stat data handler for the specified job.

Parameters:
statHandler - The real-time stat handler that associated with this stat data handler.
jobID - The job ID with which this stat handler is associated.
maxIntervals - The maximum number of collection intervals to retain.
Throws:
SLAMDServerException - If the specified job is unknown to the SLAMD server.
Method Detail

getJobID

public java.lang.String getJobID()
Retrieves the job ID with which this handler is associated.

Returns:
The job ID with which this handler is associated.

getJob

public Job getJob()
Retrieves the job with which this handler is associated.

Returns:
The job with which this handler is associated.

getStatNames

public java.lang.String[] getStatNames()
Retrieves the display names of the statistics that are available in this stat handler.

Returns:
The display names of the statistics that are available in this stat handler.

getStatValues

public double[] getStatValues(java.lang.String statName)
Retrieves the data currently available for the specified statistic.

Parameters:
statName - The name of the statistic for which to retrieve the data.
Returns:
The data currently available for the specified statistic, or null if no data is available for the specified statistic.

getFirstInterval

public int getFirstInterval(java.lang.String statName)
Retrieves the interval number of the first interval available for the specified statistic.

Parameters:
statName - The name of the statistic for which to retrieve the data.
Returns:
The interval number of the first interval available for the specified statistic, or -1 if nothing is known about that statistic.

registerStatistic

public void registerStatistic(java.lang.String statName)
Registers the specified statistic with this stat handler.

Parameters:
statName - The name of the statistic being registered.

deregisterStatistic

public void deregisterStatistic()
Deregisters a stat reporder from this stat handler. This is only used to determine whether there are any more threads still reporting. If no more threads are still reporting, then the reference to the stat information for this job is removed.


updateStatToAdd

public void updateStatToAdd(java.lang.String statName,
                            int intervalNumber,
                            double value)
Updates the data for the specified statistic to indicate that the provided value should be added to the existing data for the specified interval.

Parameters:
statName - The name of the statistic to update.
intervalNumber - The interval number with which the value is associated.
value - The value to be added to the existing values for the given interval.

updateStatToAverage

public void updateStatToAverage(java.lang.String statName,
                                int intervalNumber,
                                double value)
Updates the data for the specified statistic to indicate that the provided value should be averaged with the existing data for the specified interval.

Parameters:
statName - The name of the statistic to update.
intervalNumber - The interval number with which the value is associated.
value - The value to be averaged with the existing values for the given interval.

setLastUpdateTime

public void setLastUpdateTime()
Indicates that the lastUpdateTime should be set to the current time.


getLastUpdateTime

public long getLastUpdateTime()
Retrieves the time that this data was last updated.

Returns:
The time that this data was last updated.