public abstract class AbstractMonitorable<T> extends java.lang.Object implements Monitorable<T>
Monitorable
. Provides implementations for
metadata methods and a high performance synchronization-free implementation of Monitor
notification.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
description |
protected org.slf4j.Logger |
LOG |
private java.util.List<Monitor> |
monitors |
private java.lang.String |
name |
private ValueSemantics |
semantics |
private java.lang.Class<T> |
type |
private javax.measure.Unit<?> |
unit |
Modifier | Constructor and Description |
---|---|
protected |
AbstractMonitorable(java.lang.String name,
java.lang.String description,
java.lang.Class<T> type,
javax.measure.Unit<?> unit,
ValueSemantics semantics) |
Modifier and Type | Method and Description |
---|---|
void |
attachMonitor(Monitor monitor)
Attaches the provided Monitor.
|
java.lang.String |
getDescription() |
java.lang.String |
getName() |
ValueSemantics |
getSemantics() |
java.lang.Class<T> |
getType() |
javax.measure.Unit<?> |
getUnit() |
(package private) boolean |
isAttached(Monitor monitorToFind)
Checks if a given Monitor is registered for notifications with this Monitorable.
|
protected void |
logValue() |
protected void |
notifyMonitors() |
protected void |
registerSelf(MonitorableRegistry registry) |
void |
removeMonitor(Monitor monitor)
Removed the provided Monitor from the list of attached Monitors.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
protected final org.slf4j.Logger LOG
private final java.util.List<Monitor> monitors
private final java.lang.String name
private final java.lang.String description
private final java.lang.Class<T> type
private final javax.measure.Unit<?> unit
private final ValueSemantics semantics
protected AbstractMonitorable(java.lang.String name, java.lang.String description, java.lang.Class<T> type, javax.measure.Unit<?> unit, ValueSemantics semantics)
protected void registerSelf(MonitorableRegistry registry)
public java.lang.String getName()
getName
in interface Monitorable<T>
public java.lang.String getDescription()
getDescription
in interface Monitorable<T>
public java.lang.Class<T> getType()
getType
in interface Monitorable<T>
Monitorable.get()
method.public javax.measure.Unit<?> getUnit()
getUnit
in interface Monitorable<T>
AbstractUnit.ONE
;
values for which no unit is sensible (e.g. String values) may
return null.public ValueSemantics getSemantics()
getSemantics
in interface Monitorable<T>
public void attachMonitor(Monitor monitor)
Monitorable
attachMonitor
in interface Monitorable<T>
monitor
- the Monitor to attach.public void removeMonitor(Monitor monitor)
Monitorable
removeMonitor
in interface Monitorable<T>
monitor
- the Monitor to remove.boolean isAttached(Monitor monitorToFind)
protected final void notifyMonitors()
protected final void logValue()