Interface StatisticsTypeFactory

All Known Subinterfaces:
StatisticsFactory
All Known Implementing Classes:
DistributedSystem

public interface StatisticsTypeFactory
Instances of this interface provide methods that create instances of StatisticDescriptor and StatisticsType. Every StatisticsFactory is also a type factory.

A StatisticsTypeFactory can create a statistic of three numeric types: int, long, and double. A statistic (StatisticDescriptor) can either be a gauge meaning that its value can increase and decrease or a counter meaning that its value is strictly increasing.

The following code is an example of how to create a type using code. In this example the type has two counters:

    StatisticsTypeFactory f = ...;
    StatisticsType t = f.createType(
        "StatSampler",
        "Stats on the statistic sampler.",
        new StatisticDescriptor[] {
            f.createLongCounter("sampleCount",
                               "Total number of samples taken by this sampler.",
                               "samples"),
            f.createLongCounter("sampleTime",
                                "Total amount of time spent taking samples.",
                                "milliseconds"),
        }
    );
 

The following is an example of how to create the same type using XML. The XML data:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE statistics PUBLIC
      "-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
      "http://www.gemstone.com/dtd/statisticsType.dtd">
    <statistics>
      <type name="StatSampler">
        <description>Stats on the statistic sampler.</description>
        <stat name="sampleCount" storage="long" counter="true">
          <description>Total number of samples taken by this sampler.</description>
          <unit>samples</unit>
        </stat>
        <stat name="sampleTime" storage="long" counter="true">
          <description>Total amount of time spent taking samples.</description>
          <unit>milliseconds</unit>
        </stat>
      </type>
    </statistics>
 
The code to create the type:
      StatisticsTypeFactory f = ...;
      Reader r = new InputStreamReader("fileContainingXmlData"));
      StatisticsType type = f.createTypesFromXml(r)[0];
 

Since:
GemFire 3.0
See Also: