Package org.apache.ofbiz.base.metrics
Class MetricsFactory
- java.lang.Object
-
- org.apache.ofbiz.base.metrics.MetricsFactory
-
@ThreadSafe public final class MetricsFactory extends java.lang.Object
AMetrics
factory.
-
-
Field Summary
Fields Modifier and Type Field Description static Metrics
NULL_METRICS
A "do-nothing"Metrics
instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Metrics
getInstance(java.lang.String name, int estimationSize, long estimationTime, double smoothing, double threshold)
Creates aMetrics
instance.static Metrics
getInstance(org.w3c.dom.Element element)
Creates aMetrics
instance based onelement
attributes.static Metrics
getMetric(java.lang.String name)
Returns an existingMetric
instance with the specified name.static java.util.Collection<Metrics>
getMetrics()
Returns allMetric
instances, sorted by name.
-
-
-
Field Detail
-
NULL_METRICS
public static final Metrics NULL_METRICS
A "do-nothing"Metrics
instance.
-
-
Method Detail
-
getInstance
public static Metrics getInstance(org.w3c.dom.Element element)
Creates aMetrics
instance based onelement
attributes. If an instance with the same name already exists, it will be returned.Element Attributes Attribute Name Requirements Description Notes name Required The metric name. estimation-size Optional Positive integer number of events to include in the metrics calculation. Defaults to "100". estimation-time Optional Positive integer number of milliseconds to include in the metrics calculation. Defaults to "1000". smoothing Optional Smoothing factor - used to smooth the differences between calculations. A value of "1" disables smoothing. Defaults to "0.7". threshold Optional The metric threshold. The meaning of the threshold is determined by client code. Defaults to "0.0". - Parameters:
element
- The element whose attributes will be used to create theMetrics
instance- Returns:
- A
Metrics
instance based onelement
attributes - Throws:
java.lang.IllegalArgumentException
- ifelement
is null or if the name attribute is emptyjava.lang.NumberFormatException
- if any of the numeric attribute values are unparsable
-
getInstance
public static Metrics getInstance(java.lang.String name, int estimationSize, long estimationTime, double smoothing, double threshold)
Creates aMetrics
instance. If an instance with the same name already exists, it will be returned.- Parameters:
name
- The metric name.estimationSize
- Positive integer number of events to include in the metrics calculation.estimationTime
- Positive integer number of milliseconds to include in the metrics calculation.smoothing
- Smoothing factor - used to smooth the differences between calculations.- Returns:
- A
Metrics
instance
-
getMetric
public static Metrics getMetric(java.lang.String name)
Returns an existingMetric
instance with the specified name. Returnsnull
if the metric does not exist.- Parameters:
name
- The metric name
-
getMetrics
public static java.util.Collection<Metrics> getMetrics()
Returns allMetric
instances, sorted by name.
-
-