public interface Monitorable<T>
An interface to be implemented by any value that needs to be monitored using the Parfait monitoring system.
An Monitorable primarily exists to return a value on demand (see
get()
) but must also be capable of providing metadata about the
semantics of a value so that various output sinks may treat the value
appropriately.
Monitors use JSR-363 Unit semantics to define their value scale, however if the output sinks in use do not care about this value, or use it in any meaningful way this may not need to be provided.
It is up to the particular Monitor
implementation which uses a given
Monitorable to determine whether all Monitorables need to be 'pre-registered'
with the Monitor, or if dynamic addition of Monitorables over the lifetime of
an application is acceptable.
All monitor implementations must support concurrent access from multiple threads.
MonitoredValue
,
MonitoredConstant
,
MonitoredCounter
Modifier and Type | Method and Description |
---|---|
void |
attachMonitor(Monitor m)
Attaches the provided Monitor.
|
T |
get()
This method should never block and must return as quickly as possible.
|
java.lang.String |
getDescription() |
java.lang.String |
getName() |
ValueSemantics |
getSemantics() |
java.lang.Class<T> |
getType() |
javax.measure.Unit<?> |
getUnit() |
void |
removeMonitor(Monitor m)
Removed the provided Monitor from the list of attached Monitors.
|
java.lang.String getName()
java.lang.String getDescription()
javax.measure.Unit<?> getUnit()
AbstractUnit.ONE
;
values for which no unit is sensible (e.g. String values) may
return null.ValueSemantics getSemantics()
T get()
void attachMonitor(Monitor m)
m
- the Monitor to attach.void removeMonitor(Monitor m)
m
- the Monitor to remove.