T- The type of value that will be in the published observations.
public interface ObservationProvider<T>
ObservationProvideris any object that wants to publish
Observations to a
ObservationConsumer. When using OSGi, there are a couple of properties that should be registered to make it easier for consumers to find the proper providers.
org.flexiblepower.monitoring.observedBy: describes the component that does the observations. Normally this will be the name of the component itself.
org.flexiblepower.monitoring.observationOf: describes the physical thing that it is observing.
org.flexiblepower.monitoring.type: gives the full classname of the type of value that will be published by the provider.
org.flexiblepower.monitoring.type.X: for each attribute, the X is replaced by the name of the attribute (as will be returned by the
methodand the value is the type description, usually the classname.
org.flexiblepower.monitoring.type.X.unit: optionally describes the unit in which the attribute will be transformed. This is only relevant for raw values, like doubles or integers.
org.flexiblepower.monitoring.type.X.optional: optionally describes if an attribute is optional. By default the consumer may assume that all attributes are available each time, but by setting this to true it can indicate otherwise.
|Modifier and Type||Method and Description|
Get the last published
Binds the consumer to this provider.
Unbinds the consumer from this provider.
void subscribe(ObservationConsumer<? super T> consumer)
ObservationConsumerthat will be bound to this provider.
void unsubscribe(ObservationConsumer<? super T> consumer)
ObservationConsumerthat will be unbound from this provider.