Rio Project 4.2 API Documentation



org.rioproject.system.measurable
Class MeasurableCapability

java.lang.Object
  extended by org.rioproject.watch.Watch
      extended by org.rioproject.watch.ThresholdWatch
          extended by org.rioproject.watch.PeriodicWatch
              extended by org.rioproject.system.measurable.MeasurableCapability
All Implemented Interfaces:
ResourceCostProducer, MeasurableCapabilityMBean, PeriodicWatchMBean, ThresholdWatchMBean, WatchMBean
Direct Known Subclasses:
CPU, DiskSpace, Memory, MemoryPool

public abstract class MeasurableCapability
extends PeriodicWatch
implements ResourceCostProducer, MeasurableCapabilityMBean

A MeasurableCapability refers to a depletion oriented resource or capability on a ComputeResource

Author:
Dennis Reedy

Field Summary
protected  MeasuredResource lastMeasured
           
protected  MeasurableMonitor monitor
          The MeasurableMonitor to use
protected  int sampleSize
          The sampleSize property specifies the amount of samples the MeasurableCapability will accumulate in the period defined by the reportRate in order to produce a result.
 
Fields inherited from class org.rioproject.watch.PeriodicWatch
DEFAULT_PERIOD
 
Fields inherited from class org.rioproject.watch.Watch
COMPONENT, DEFAULT_VIEW, id, localRef, logger, watchDataSource
 
Constructor Summary
protected MeasurableCapability(String id, String componentName, Configuration config)
           
 
Method Summary
 void addSecondaryThresholdManager(ThresholdManager thresholdManager)
          Add a secondary ThresholdManager to the MeasurableCapability.
 void addWatchRecord(Calculable record)
          Add a Calculable to the watch and update state
 ResourceCost calculateResourceCost(double units, long duration)
          Calculate the cost based on the units provided.
 Configuration getConfiguration()
          Get the Configuration property
 MeasuredResource getMeasuredResource()
          Get the MeasuredResource object, which represents this object's measured capability
 Observable getObservable()
          Get the Observable instance
 int getSampleSize()
          Get the sampleSize property
 SLA getSLA()
          Get the SLA for ths MeasurableCapability.
protected  Collection<ThresholdManager> getThresholdManagers()
          Get the registered ThresholdManagers
 boolean isEnabled()
          Get is this measurable capability is enabled
 void removeSecondaryThresholdManager(ThresholdManager thresholdManager)
          Remove a secondary ThresholdManager from the MeasurableCapability
protected  void setEnabled(boolean enabled)
           
protected  void setLastMeasuredResource(MeasuredResource lastMeasured)
           
 void setMeasurableMonitor(MeasurableMonitor monitor)
          Set the MeasurableMonitor
 void setResourceCostModel(ResourceCostModel costModel)
          Set the ResourceCostModel for the MeasurableCapability
 void setSampleSize(int sampleSize)
          Set the sampleSize for the MeasurableCapability
 void setSLA(SLA sla)
          Set the SLA for ths MeasurableCapability.
 void setWatchDataSource(WatchDataSource watchDataSource)
          Override parent's setWatchDataSource to set the size
 
Methods inherited from class org.rioproject.watch.PeriodicWatch
getPeriod, setPeriod, start, stop
 
Methods inherited from class org.rioproject.watch.ThresholdWatch
addThresholdListener, getBreachedCount, getClearedCount, getCurrentHighThreshold, getCurrentLowThreshold, getHighThreshold, getLowThreshold, getThresholdManager, getThresholdValues, removeThresholdListener, setCurrentHighThreshold, setCurrentLowThreshold, setThresholdValues
 
Methods inherited from class org.rioproject.watch.Watch
clear, equals, getCalculables, getId, getLastCalculableValue, getView, getWatchDataSource, hashCode, main, setView, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rioproject.system.measurable.MeasurableCapabilityMBean
getUtilization
 
Methods inherited from interface org.rioproject.watch.PeriodicWatchMBean
checkValue, getPeriod, setPeriod, start, stop
 
Methods inherited from interface org.rioproject.watch.ThresholdWatchMBean
getBreachedCount, getClearedCount, getCurrentHighThreshold, getCurrentLowThreshold, getHighThreshold, getLowThreshold, setCurrentHighThreshold, setCurrentLowThreshold
 
Methods inherited from interface org.rioproject.watch.WatchMBean
clear, getCalculables, getId, getLastCalculableValue
 

Field Detail

sampleSize

protected int sampleSize
The sampleSize property specifies the amount of samples the MeasurableCapability will accumulate in the period defined by the reportRate in order to produce a result.


monitor

protected MeasurableMonitor monitor
The MeasurableMonitor to use


lastMeasured

protected MeasuredResource lastMeasured
Constructor Detail

MeasurableCapability

protected MeasurableCapability(String id,
                               String componentName,
                               Configuration config)
Method Detail

setEnabled

protected void setEnabled(boolean enabled)

isEnabled

public boolean isEnabled()
Get is this measurable capability is enabled

Returns:
If the measurable capability is enabled return true, otherwise false. If the measurable capability is not enabled, it will not be added

getConfiguration

public Configuration getConfiguration()
Get the Configuration property

Returns:
The configuration for the MeasurableCapability

setWatchDataSource

public void setWatchDataSource(WatchDataSource watchDataSource)
Override parent's setWatchDataSource to set the size

Overrides:
setWatchDataSource in class Watch
Parameters:
watchDataSource - The new WatchDataSource. The WatchDataSource will have the id, configuration and view properties injected, and will also be initialized.

setSLA

public void setSLA(SLA sla)
Set the SLA for ths MeasurableCapability.

Parameters:
sla - The SLA for this MeasurableCapability

getSLA

public SLA getSLA()
Get the SLA for ths MeasurableCapability.

Returns:
The SLA for this MeasurableCapability

setSampleSize

public void setSampleSize(int sampleSize)
Description copied from interface: MeasurableCapabilityMBean
Set the sampleSize for the MeasurableCapability

Specified by:
setSampleSize in interface MeasurableCapabilityMBean
Parameters:
sampleSize - The number of samples the MeasurableCapability will accumulate in the period defined by the period in order to produce a result.
See Also:
MeasurableCapabilityMBean.setSampleSize(int)

getSampleSize

public int getSampleSize()
Description copied from interface: MeasurableCapabilityMBean
Get the sampleSize property

Specified by:
getSampleSize in interface MeasurableCapabilityMBean
Returns:
The number of samples the MeasurableCapability will accumulate in the period defined by the period in order to produce a result.
See Also:
MeasurableCapabilityMBean.getSampleSize()

addSecondaryThresholdManager

public void addSecondaryThresholdManager(ThresholdManager thresholdManager)
Add a secondary ThresholdManager to the MeasurableCapability. The primary ThresholdManager and the ThresholdValues are set when this class is loaded. By offering secondary ThresholdManager instances, services can set their own ranges and be notified accordingly

Parameters:
thresholdManager - The ThresholdManager

removeSecondaryThresholdManager

public void removeSecondaryThresholdManager(ThresholdManager thresholdManager)
Remove a secondary ThresholdManager from the MeasurableCapability

Parameters:
thresholdManager - The ThresholdManager

setResourceCostModel

public void setResourceCostModel(ResourceCostModel costModel)
Set the ResourceCostModel for the MeasurableCapability

Parameters:
costModel - The ResourceCostModel which will determine the cost of using this MeasurableCapability

calculateResourceCost

public ResourceCost calculateResourceCost(double units,
                                          long duration)
Description copied from interface: ResourceCostProducer
Calculate the cost based on the units provided. The cost will be computed using the ResourceCostModel

Specified by:
calculateResourceCost in interface ResourceCostProducer
Parameters:
units - The units to be costed
duration - The amount of time in milliseconds the resource has been used for
Returns:
A ResourceCost object
See Also:
ResourceCostProducer.calculateResourceCost(double, long)

getMeasuredResource

public MeasuredResource getMeasuredResource()
Get the MeasuredResource object, which represents this object's measured capability

Returns:
This object's measured capability

setLastMeasuredResource

protected void setLastMeasuredResource(MeasuredResource lastMeasured)

setMeasurableMonitor

public void setMeasurableMonitor(MeasurableMonitor monitor)
Set the MeasurableMonitor

Parameters:
monitor - The MeasurableMonitor

addWatchRecord

public void addWatchRecord(Calculable record)
Add a Calculable to the watch and update state

Overrides:
addWatchRecord in class ThresholdWatch
Parameters:
record - A Calculable record

getThresholdManagers

protected Collection<ThresholdManager> getThresholdManagers()
Get the registered ThresholdManagers

Returns:
The registered ThresholdManagers. A new unmodifiable collection is allocated each time

getObservable

public Observable getObservable()
Get the Observable instance

Returns:
The object to subscribe for changes in MeasurableCapability state

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.