FileDocCategorySizeDatePackage
StatisticMonitoredAttribute.javaAPI DocJava SE 5 API3454Fri Aug 26 14:54:38 BST 2005com.sun.corba.se.spi.monitoring

StatisticMonitoredAttribute

public class StatisticMonitoredAttribute extends MonitoredAttributeBase

author
Hemanth Puttaswamy

StatisticsMonitoredAttribute is provided as a convenience to collect the Statistics of any entity. The getValue() call will be delegated to the StatisticsAccumulator set by the user.

Fields Summary
private StatisticsAccumulator
statisticsAccumulator
private Object
mutex
Constructors Summary
public StatisticMonitoredAttribute(String name, String desc, StatisticsAccumulator s, Object mutex)

Constructs the StaisticMonitoredAttribute, builds the required MonitoredAttributeInfo with Long as the class type and is always readonly attribute.

param
name Of this attribute

return
a StatisticMonitoredAttribute

param
desc should provide a good description on the kind of statistics collected, a good example is "Connection Response Time Stats will Provide the detailed stats based on the samples provided from every request completion time"

param
s is the StatisticsAcumulator that user will use to accumulate the samples and this Attribute Object will get the computed statistics values from.

param
mutex using which clearState() and getValue() calls need to be locked.

        
        super( name );
        MonitoredAttributeInfoFactory f = 
            MonitoringFactories.getMonitoredAttributeInfoFactory();
        MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo(
                desc, String.class, false, true );

        this.setMonitoredAttributeInfo( maInfo );
        this.statisticsAccumulator = s;
        this.mutex = mutex;
    
Methods Summary
public voidclearState()
Clears the state on Statistics Accumulator, After this call all samples are treated fresh and the old sample computations are disregarded.

        synchronized( mutex ) {
            statisticsAccumulator.clearState( );
        }
    
public StatisticsAccumulatorgetStatisticsAccumulator()
Gets the statistics accumulator associated with StatisticMonitoredAttribute. Usually, the user don't need to use this method as they can keep the handle to Accumulator to collect the samples.

        return statisticsAccumulator;
    
public java.lang.ObjectgetValue()
Gets the value from the StatisticsAccumulator, the value will be a formatted String with the computed statistics based on the samples accumulated in the Statistics Accumulator.

        synchronized( mutex ) {
            return statisticsAccumulator.getValue( );
        }