Interface IpdMeter
- All Known Subinterfaces:
CounterMeter,CustomMeter<T>,JmxCopyMeter,StatsMeter,ValueMeter
- All Known Implementing Classes:
AbstractIpdMeter,CounterMeter.Noop,CustomMeter.Noop,CustomMeterImpl,IpdMeter.NoopMeter,JmxCopyMeter.Noop,StatsMeter.Noop,ValueMeter.Noop
public interface IpdMeter
Base interface for all IPD meters.
Implementations of this interface must be thread-safe and make the meter visible in JMX when its enabled and registered.
- Since:
- 3.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Permanently closes this instance of the meter.getAttributes(boolean extraAttributes) Returns the attributes of the meter.Meter configuration is constructed when meter is created for the first time and is immutable.ObjectName of the MBean.Identifies type of the meter.voidHides the meter in JMX until the next value update.booleanisClosed()Checks if the meter is closed.booleanbooleanMeter might be enabled, but temporarily hidden in JMX.longReturns the timestamp of the last value update in milliseconds.
-
Method Details
-
getTypeId
String getTypeId()Identifies type of the meter.- Returns:
- Type ID of the meter
-
getMeterKey
MeterKey getMeterKey()- Returns:
- MeterKey that identifies meter by name and tag values
-
getConfig
MeterConfig getConfig()Meter configuration is constructed when meter is created for the first time and is immutable.- Returns:
- Read-only meter configuration for this meter
-
getObjectName
ObjectName getObjectName()ObjectName of the MBean. Can be used to query this metric value in JMX.- Returns:
- ObjectName of this metric
-
isEnabled
boolean isEnabled()- Returns:
- false if the meter is closed
close()orMeterConfig.getEnabledCheck()check returns false, true otherwise
-
isVisible
boolean isVisible()Meter might be enabled, but temporarily hidden in JMX. This might happen when meter value was not set yet or methodhideUntilUpdate()was called.- Returns:
- true if the meter is visible in JMX, false otherwise
-
hideUntilUpdate
void hideUntilUpdate()Hides the meter in JMX until the next value update.isVisible()will return false until the next value update. -
lastUpdateMillis
long lastUpdateMillis()Returns the timestamp of the last value update in milliseconds. SeeClock.millis().- Returns:
- timestamp of the last value update in milliseconds
-
getAttributes
Returns the attributes of the meter.- Parameters:
extraAttributes- if true, all attributes visible in JMX will be returned, otherwise only the most important ones- Returns:
- Map of meter attributes, will return empty map if attributes can't be retrieved
-
close
void close()Permanently closes this instance of the meter. This instance will always return false forisEnabled()andisVisible().
This method is called on meter instances that are removed from theIpdRegistry -
isClosed
boolean isClosed()Checks if the meter is closed. A closed meter can't be enabled or visible in JMX. It's a terminal state that is triggered when a meter is removed from the IpdRegistry. You can get a new instance of the meter from theIpdRegistry.- Returns:
- true if the meter is closed, false otherwise
-