T
- the type of a metric valuepublic class JabbixActiveMetric<T> extends JabbixMetric<T> implements java.util.concurrent.Delayed
Constructor and Description |
---|
JabbixActiveMetric(java.lang.String key,
java.lang.Class<T> type,
T value,
long period,
boolean active)
Creates a new active metric entry with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.util.concurrent.Delayed o)
Indicates if the current metric is less than, equal to or greater than
the given
Delayed object. |
int |
compareTo(JabbixActiveMetric<?> m)
Indicates if the current metric is less than, equal to or greater than
the given one.
|
long |
getDelay(java.util.concurrent.TimeUnit unit)
Returns the remaining time for the next refresh of the metric.
|
java.util.Date |
getNextCheck()
Returns the date and time this metric value should be refreshed
(on the target server).
|
long |
getPeriod()
Returns the value refresh period (in milliseconds).
|
java.util.Date |
getUpdated()
Indicates when (and whether) the metric value was updated.
|
boolean |
isActive()
Indicates either the metric is "active".
|
void |
setActive(boolean active)
Sets the metric "activity" status.
|
equals, getKey, getValue, getValueType, toString, updateValue
public JabbixActiveMetric(java.lang.String key, java.lang.Class<T> type, T value, long period, boolean active)
key
- the name of the metricperiod
- the refresh period in millisecondsactive
- the count-down statuspublic boolean isActive()
getNextCheck()
property is non-null.public void setActive(boolean active)
nextCheck
property is set to the sum of current time value and the
period value specified for the metric (
getPeriod()
). If the status of a metric
changes form active to inactive then the
nextCheck
is set to null. Otherwise the nextCheck
is leaved unchanged.active
- the status value to be setpublic java.util.Date getNextCheck()
public long getPeriod()
public int compareTo(JabbixActiveMetric<?> m)
nextCheck
properties are
compared. Otherwise the active metric is always less that the inactive
one (so the inactive entries are always sit at the end of the queue).m
- active metric to compare toActiveMetricTable
public long getDelay(java.util.concurrent.TimeUnit unit)
nextCheck
value is not set) then the maximal long value
Long.MAX_VALUE
is returned. Otherwise the difference between
current time and nextCheck
value is returned represented in the specified units.getDelay
in interface java.util.concurrent.Delayed
public int compareTo(java.util.concurrent.Delayed o)
Delayed
object. Active metric objects are compared
using the compareTo(JabbixActiveMetric)
method. If the given object is not an active metric then the metric is
supposed to be less (sooner) than the given object.compareTo
in interface java.lang.Comparable<java.util.concurrent.Delayed>
o
- the object to compare topublic java.util.Date getUpdated()
JabbixMetric.updateValue(java.lang.Object)