Top Description Inners Fields Constructors Methods
javax.management.monitor

public Class GaugeMonitor

extends Monitor
implements GaugeMonitorMBean
Class Inheritance
All Implemented Interfaces
javax.management.monitor.GaugeMonitorMBean, javax.management.monitor.MonitorMBean
Static Imports
com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER, javax.management.monitor.Monitor.NumericalType.*, javax.management.monitor.MonitorNotification.*

Defines a monitor MBean designed to observe the values of a gauge attribute.

A gauge monitor observes an attribute that is continuously variable with time. A gauge monitor sends notifications as follows:

This provides a hysteresis mechanism to avoid repeated triggering of notifications when the attribute value makes small oscillations around the high or low threshold value.

If the gauge difference mode is used, the value of the derived gauge is calculated as the difference between the observed gauge values for two successive observations.
The derived gauge value (V[t]) is calculated using the following method:

This implementation of the gauge monitor requires the observed attribute to be of the type integer or floating-point (Byte, Integer, Short, Long, Float, Double).
Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private boolean
differenceMode

Flag indicating if the gauge difference mode is used.

private static final int
private Number
highThreshold

Gauge high threshold.

private Number
lowThreshold

Gauge low threshold.

private static final MBeanNotificationInfo[]
private boolean
notifyHigh

Flag indicating if the gauge monitor notifies when exceeding the high threshold.

private boolean
notifyLow

Flag indicating if the gauge monitor notifies when exceeding the low threshold.

private static final int
private static final int
private static final String[]
Inherited from javax.management.monitor.Monitor:
alreadyNotifiedalreadyNotifiedscapacityIncrementdbgTagelementCountINTEGER_ZEROOBSERVED_ATTRIBUTE_ERROR_NOTIFIEDOBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIEDOBSERVED_OBJECT_ERROR_NOTIFIEDobservedObjectsRESET_FLAGS_ALREADY_NOTIFIEDRUNTIME_ERROR_NOTIFIEDserverTHRESHOLD_ERROR_NOTIFIED

Constructor Summary

AccessConstructor and Description
public
GaugeMonitor()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized MonitorNotification
pack-priv Monitor.ObservedObject
createObservedObject(ObjectName object)

Overrides javax.management.monitor.Monitor.createObservedObject.

Factory method for ObservedObject creation.

public synchronized Number

Returns:

The derived gauge of the specified object.
getDerivedGauge
(ObjectName
the name of the MBean.
object
)

Overrides javax.management.monitor.Monitor.getDerivedGauge.

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGauge.

Gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.

public synchronized Number

Returns:

The derived gauge.
getDerivedGauge
()

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGauge.

Deprecated As of JMX 1.2, replaced by getDerivedGauge(ObjectName)

Returns the derived gauge of the first object in the set of observed MBeans.

pack-priv synchronized Comparable<?>
public synchronized long

Returns:

The derived gauge timestamp of the specified object.
getDerivedGaugeTimeStamp
(ObjectName
the name of the object whose derived gauge timestamp is to be returned.
object
)

Overrides javax.management.monitor.Monitor.getDerivedGaugeTimeStamp.

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGaugeTimeStamp.

Gets the derived gauge timestamp of the specified object, if this object is contained in the set of observed MBeans, or 0 otherwise.

public synchronized long

Returns:

The derived gauge timestamp.
getDerivedGaugeTimeStamp
()

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGaugeTimeStamp.

Deprecated As of JMX 1.2, replaced by getDerivedGaugeTimeStamp(ObjectName)

Gets the derived gauge timestamp of the first object in the set of observed MBeans.

public synchronized boolean

Returns:

true if the difference mode is used, false otherwise.
getDifferenceMode
()

Implements javax.management.monitor.GaugeMonitorMBean.getDifferenceMode.

Gets the difference mode flag value common to all observed MBeans.

public synchronized Number

Returns:

The high threshold value.
getHighThreshold
()

Implements javax.management.monitor.GaugeMonitorMBean.getHighThreshold.

Gets the high threshold value common to all observed MBeans.

public synchronized Number

Returns:

The low threshold value.
getLowThreshold
()

Implements javax.management.monitor.GaugeMonitorMBean.getLowThreshold.

Gets the low threshold value common to all observed MBeans.

public MBeanNotificationInfo[]
getNotificationInfo()

Overrides javax.management.NotificationBroadcasterSupport.getNotificationInfo.

Implements javax.management.NotificationBroadcaster.getNotificationInfo.

Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the gauge monitor.

public synchronized boolean

Returns:

true if the gauge monitor notifies when exceeding the high threshold, false otherwise.
getNotifyHigh
()

Implements javax.management.monitor.GaugeMonitorMBean.getNotifyHigh.

Gets the high notification's on/off switch value common to all observed MBeans.

public synchronized boolean

Returns:

true if the gauge monitor notifies when exceeding the low threshold, false otherwise.
getNotifyLow
()

Implements javax.management.monitor.GaugeMonitorMBean.getNotifyLow.

Gets the low notification's on/off switch value common to all observed MBeans.

pack-priv synchronized boolean
isComparableTypeValid(ObjectName object, String attribute, Comparable<?> value)

Overrides javax.management.monitor.Monitor.isComparableTypeValid.

This method globally sets the derived gauge type for the given "object" and "attribute" after checking that the type of the supplied observed attribute value is one of the value types supported by this monitor.

private boolean

Returns:

true if the first specified Number is greater than or equal to the last, false otherwise.
isFirstGreaterThanLast
(Number
The first Number to compare with the second.
greater
,
Number
The second Number to compare with the first.
less
,
Monitor.NumericalType
The number type.
type
)

Tests if the first specified Number is greater than or equal to the last.

private boolean

Returns:

true if the first specified Number is strictly greater than the last, false otherwise.
isFirstStrictlyGreaterThanLast
(Number
The first Number to compare with the second.
greater
,
Number
The second Number to compare with the first.
less
,
String
The number class name.
className
)

Tests if the first specified Number is strictly greater than the last.

pack-priv synchronized boolean

Returns:

true if type is the same, false otherwise.
isThresholdTypeValid
(ObjectName
The observed object.
object
,
String
The observed attribute.
attribute
,
Comparable<?>
The sample value.
value
)

Overrides javax.management.monitor.Monitor.isThresholdTypeValid.

Tests if the threshold high and threshold low are both of the same type as the gauge.

pack-priv synchronized void
private synchronized void
setDerivedGaugeWithDifference(Number
The value of the observed attribute.
scanGauge
,
GaugeMonitor.GaugeMonitorObservedObject
The observed object.
o
)

Sets the derived gauge when the differenceMode flag is set to true.

public synchronized void
setDifferenceMode(boolean
The difference mode flag value.
value
)

Implements javax.management.monitor.GaugeMonitorMBean.setDifferenceMode.

Sets the difference mode flag value common to all observed MBeans.

public synchronized void
setNotifyHigh(boolean
The high notification's on/off switch value.
value
)

Implements javax.management.monitor.GaugeMonitorMBean.setNotifyHigh.

Sets the high notification's on/off switch value common to all observed MBeans.

public synchronized void
setNotifyLow(boolean
The low notification's on/off switch value.
value
)

Implements javax.management.monitor.GaugeMonitorMBean.setNotifyLow.

Sets the low notification's on/off switch value common to all observed MBeans.

public synchronized void
setThresholds(Number
The high threshold value.
highValue
,
Number
The low threshold value.
lowValue
)

Implements javax.management.monitor.GaugeMonitorMBean.setThresholds.

Sets the high and the low threshold values common to all observed MBeans.

public synchronized void
start()

Implements abstract javax.management.monitor.Monitor.start.

Implements javax.management.monitor.MonitorMBean.start.

Starts the gauge monitor.

public synchronized void
stop()

Implements abstract javax.management.monitor.Monitor.stop.

Implements javax.management.monitor.MonitorMBean.stop.

Stops the gauge monitor.

private synchronized boolean

Returns:

true if the derived gauge value is valid, false otherwise. The derived gauge value is invalid when the differenceMode flag is set to true and it is the first notification (so we haven't 2 consecutive values to update the derived gauge).
updateDerivedGauge
(Object
The value of the observed attribute.
scanGauge
,
GaugeMonitor.GaugeMonitorObservedObject
The observed object.
o
)

Updates the derived gauge attribute of the observed object.

private synchronized MonitorNotification
updateNotifications(GaugeMonitor.GaugeMonitorObservedObject
The observed object.
o
)

Updates the notification attribute of the observed object and notifies the listeners only once if the notify flag is set to true.

Inherited from javax.management.monitor.Monitor:
addObservedObjectbuildErrorNotificationclassForTypecomputeAlreadyNotifiedIndexcontainsObservedObjectcreateAlreadyNotifieddoStartdoStopgetAttributegetComparableFromAttributegetGranularityPeriodgetObservedAttributegetObservedObjectgetObservedObjectgetObservedObjectsisActiveisAlreadyNotifiedisValidForTypepostDeregisterpostRegisterpreDeregisterpreRegisterremoveObservedObjectresetAllAlreadyNotifiedresetAlreadyNotifiedsetAlreadyNotifiedsetGranularityPeriodsetObservedAttributesetObservedObjectupdateAlreadyNotifiedupdateDeprecatedAlreadyNotified

Field Detail

differenceModeback to summary
private boolean differenceMode

Flag indicating if the gauge difference mode is used. If the gauge difference mode is used, the derived gauge is the difference between two consecutive observed values. Otherwise, the derived gauge is directly the value of the observed attribute.
The default value is set to false.

FALLINGback to summary
private static final int FALLING
highThresholdback to summary
private Number highThreshold

Gauge high threshold.
The default value is a null Integer object.

lowThresholdback to summary
private Number lowThreshold

Gauge low threshold.
The default value is a null Integer object.

notifsInfoback to summary
private static final MBeanNotificationInfo[] notifsInfo
notifyHighback to summary
private boolean notifyHigh

Flag indicating if the gauge monitor notifies when exceeding the high threshold.
The default value is false.

notifyLowback to summary
private boolean notifyLow

Flag indicating if the gauge monitor notifies when exceeding the low threshold.
The default value is false.

RISINGback to summary
private static final int RISING
RISING_OR_FALLINGback to summary
private static final int RISING_OR_FALLING
typesback to summary
private static final String[] types

Constructor Detail

GaugeMonitorback to summary
public GaugeMonitor()

Default constructor.

Method Detail

buildAlarmNotificationback to summary
pack-priv synchronized MonitorNotification buildAlarmNotification(ObjectName object, String attribute, Comparable<?> value)

Overrides javax.management.monitor.Monitor.buildAlarmNotification.

Annotations
@Override
createObservedObjectback to summary
pack-priv Monitor.ObservedObject createObservedObject(ObjectName object)

Overrides javax.management.monitor.Monitor.createObservedObject.

Factory method for ObservedObject creation.

Annotations
@Override
Since
1.6
getDerivedGaugeback to summary
public synchronized Number getDerivedGauge(ObjectName object)

Overrides javax.management.monitor.Monitor.getDerivedGauge.

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGauge.

Gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.

Parameters
object:ObjectName

the name of the MBean.

Returns:Number

The derived gauge of the specified object.

Annotations
@Override
getDerivedGaugeback to summary
public synchronized Number getDerivedGauge()

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGauge.

Deprecated

As of JMX 1.2, replaced by getDerivedGauge(ObjectName)

Returns the derived gauge of the first object in the set of observed MBeans.

Returns:Number

The derived gauge.

Annotations
@Deprecated
getDerivedGaugeFromComparableback to summary
pack-priv synchronized Comparable<?> getDerivedGaugeFromComparable(ObjectName object, String attribute, Comparable<?> value)

Overrides javax.management.monitor.Monitor.getDerivedGaugeFromComparable.

Annotations
@Override
getDerivedGaugeTimeStampback to summary
public synchronized long getDerivedGaugeTimeStamp(ObjectName object)

Overrides javax.management.monitor.Monitor.getDerivedGaugeTimeStamp.

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGaugeTimeStamp.

Gets the derived gauge timestamp of the specified object, if this object is contained in the set of observed MBeans, or 0 otherwise.

Parameters
object:ObjectName

the name of the object whose derived gauge timestamp is to be returned.

Returns:long

The derived gauge timestamp of the specified object.

Annotations
@Override
getDerivedGaugeTimeStampback to summary
public synchronized long getDerivedGaugeTimeStamp()

Implements javax.management.monitor.GaugeMonitorMBean.getDerivedGaugeTimeStamp.

Deprecated

As of JMX 1.2, replaced by getDerivedGaugeTimeStamp(ObjectName)

Gets the derived gauge timestamp of the first object in the set of observed MBeans.

Returns:long

The derived gauge timestamp.

Annotations
@Deprecated
getDifferenceModeback to summary
public synchronized boolean getDifferenceMode()

Implements javax.management.monitor.GaugeMonitorMBean.getDifferenceMode.

Gets the difference mode flag value common to all observed MBeans.

Returns:boolean

true if the difference mode is used, false otherwise.

See Also
setDifferenceMode
getHighThresholdback to summary
public synchronized Number getHighThreshold()

Implements javax.management.monitor.GaugeMonitorMBean.getHighThreshold.

Gets the high threshold value common to all observed MBeans.

Returns:Number

The high threshold value.

See Also
setThresholds
getLowThresholdback to summary
public synchronized Number getLowThreshold()

Implements javax.management.monitor.GaugeMonitorMBean.getLowThreshold.

Gets the low threshold value common to all observed MBeans.

Returns:Number

The low threshold value.

See Also
setThresholds
getNotificationInfoback to summary
public MBeanNotificationInfo[] getNotificationInfo()

Overrides javax.management.NotificationBroadcasterSupport.getNotificationInfo.

Implements javax.management.NotificationBroadcaster.getNotificationInfo.

Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the gauge monitor.

Returns:MBeanNotificationInfo[]

Doc from javax.management.NotificationBroadcaster.getNotificationInfo.

the array of possible notifications.

Annotations
@Override
getNotifyHighback to summary
public synchronized boolean getNotifyHigh()

Implements javax.management.monitor.GaugeMonitorMBean.getNotifyHigh.

Gets the high notification's on/off switch value common to all observed MBeans.

Returns:boolean

true if the gauge monitor notifies when exceeding the high threshold, false otherwise.

See Also
setNotifyHigh
getNotifyLowback to summary
public synchronized boolean getNotifyLow()

Implements javax.management.monitor.GaugeMonitorMBean.getNotifyLow.

Gets the low notification's on/off switch value common to all observed MBeans.

Returns:boolean

true if the gauge monitor notifies when exceeding the low threshold, false otherwise.

See Also
setNotifyLow
isComparableTypeValidback to summary
pack-priv synchronized boolean isComparableTypeValid(ObjectName object, String attribute, Comparable<?> value)

Overrides javax.management.monitor.Monitor.isComparableTypeValid.

This method globally sets the derived gauge type for the given "object" and "attribute" after checking that the type of the supplied observed attribute value is one of the value types supported by this monitor.

Annotations
@Override
isFirstGreaterThanLastback to summary
private boolean isFirstGreaterThanLast(Number greater, Number less, Monitor.NumericalType type)

Tests if the first specified Number is greater than or equal to the last. Both integer and floating-point types are allowed.

Parameters
greater:Number

The first Number to compare with the second.

less:Number

The second Number to compare with the first.

type:Monitor.NumericalType

The number type.

Returns:boolean

true if the first specified Number is greater than or equal to the last, false otherwise.

isFirstStrictlyGreaterThanLastback to summary
private boolean isFirstStrictlyGreaterThanLast(Number greater, Number less, String className)

Tests if the first specified Number is strictly greater than the last. Both integer and floating-point types are allowed.

Parameters
greater:Number

The first Number to compare with the second.

less:Number

The second Number to compare with the first.

className:String

The number class name.

Returns:boolean

true if the first specified Number is strictly greater than the last, false otherwise.

isThresholdTypeValidback to summary
pack-priv synchronized boolean isThresholdTypeValid(ObjectName object, String attribute, Comparable<?> value)

Overrides javax.management.monitor.Monitor.isThresholdTypeValid.

Tests if the threshold high and threshold low are both of the same type as the gauge. Both integer and floating-point types are allowed.

Note

If the optional lowThreshold or highThreshold have not been initialized, their default value is an Integer object with a value equal to zero.

Parameters
object:ObjectName

The observed object.

attribute:String

The observed attribute.

value:Comparable<?>

The sample value.

Returns:boolean

true if type is the same, false otherwise.

Annotations
@Override
onErrorNotificationback to summary
pack-priv synchronized void onErrorNotification(MonitorNotification notification)

Overrides javax.management.monitor.Monitor.onErrorNotification.

Annotations
@Override
setDerivedGaugeWithDifferenceback to summary
private synchronized void setDerivedGaugeWithDifference(Number scanGauge, GaugeMonitor.GaugeMonitorObservedObject o)

Sets the derived gauge when the differenceMode flag is set to true. Both integer and floating-point types are allowed.

Parameters
scanGauge:Number

The value of the observed attribute.

o:GaugeMonitor.GaugeMonitorObservedObject

The observed object.

setDifferenceModeback to summary
public synchronized void setDifferenceMode(boolean value)

Implements javax.management.monitor.GaugeMonitorMBean.setDifferenceMode.

Sets the difference mode flag value common to all observed MBeans.

Parameters
value:boolean

The difference mode flag value.

See Also
getDifferenceMode
setNotifyHighback to summary
public synchronized void setNotifyHigh(boolean value)

Implements javax.management.monitor.GaugeMonitorMBean.setNotifyHigh.

Sets the high notification's on/off switch value common to all observed MBeans.

Parameters
value:boolean

The high notification's on/off switch value.

See Also
getNotifyHigh
setNotifyLowback to summary
public synchronized void setNotifyLow(boolean value)

Implements javax.management.monitor.GaugeMonitorMBean.setNotifyLow.

Sets the low notification's on/off switch value common to all observed MBeans.

Parameters
value:boolean

The low notification's on/off switch value.

See Also
getNotifyLow
setThresholdsback to summary
public synchronized void setThresholds(Number highValue, Number lowValue) throws IllegalArgumentException

Implements javax.management.monitor.GaugeMonitorMBean.setThresholds.

Sets the high and the low threshold values common to all observed MBeans.

Parameters
highValue:Number

The high threshold value.

lowValue:Number

The low threshold value.

Exceptions
IllegalArgumentException:
The specified high/low threshold is null or the low threshold is greater than the high threshold or the high threshold and the low threshold are not of the same type.
See Also
getHighThreshold, getLowThreshold
startback to summary
public synchronized void start()

Implements abstract javax.management.monitor.Monitor.start.

Implements javax.management.monitor.MonitorMBean.start.

Starts the gauge monitor.

stopback to summary
public synchronized void stop()

Implements abstract javax.management.monitor.Monitor.stop.

Implements javax.management.monitor.MonitorMBean.stop.

Stops the gauge monitor.

updateDerivedGaugeback to summary
private synchronized boolean updateDerivedGauge(Object scanGauge, GaugeMonitor.GaugeMonitorObservedObject o)

Updates the derived gauge attribute of the observed object.

Parameters
scanGauge:Object

The value of the observed attribute.

o:GaugeMonitor.GaugeMonitorObservedObject

The observed object.

Returns:boolean

true if the derived gauge value is valid, false otherwise. The derived gauge value is invalid when the differenceMode flag is set to true and it is the first notification (so we haven't 2 consecutive values to update the derived gauge).

updateNotificationsback to summary
private synchronized MonitorNotification updateNotifications(GaugeMonitor.GaugeMonitorObservedObject o)

Updates the notification attribute of the observed object and notifies the listeners only once if the notify flag is set to true.

Parameters
o:GaugeMonitor.GaugeMonitorObservedObject

The observed object.

javax.management.monitor back to summary

pack-priv Class GaugeMonitor.GaugeMonitorObservedObject

extends ObservedObject
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private Number
private int
private Monitor.NumericalType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final synchronized boolean
public final synchronized Number
public final synchronized int
public final synchronized Monitor.NumericalType
public final synchronized void
setDerivedGaugeValid(boolean derivedGaugeValid)

public final synchronized void
setPreviousScanGauge(Number previousScanGauge)

public final synchronized void
setStatus(int status)

public final synchronized void
Inherited from javax.management.monitor.Monitor.ObservedObject:
getAlreadyNotifiedgetDerivedGaugegetDerivedGaugeTimeStampgetObservedObjectsetAlreadyNotifiedsetDerivedGaugesetDerivedGaugeTimeStamp

Field Detail

derivedGaugeValidback to summary
private boolean derivedGaugeValid
previousScanGaugeback to summary
private Number previousScanGauge
statusback to summary
private int status
typeback to summary
private Monitor.NumericalType type

Constructor Detail

GaugeMonitorObservedObjectback to summary
public GaugeMonitorObservedObject(ObjectName observedObject)

Method Detail

getDerivedGaugeValidback to summary
public final synchronized boolean getDerivedGaugeValid()
getPreviousScanGaugeback to summary
public final synchronized Number getPreviousScanGauge()
getStatusback to summary
public final synchronized int getStatus()
getTypeback to summary
public final synchronized Monitor.NumericalType getType()
setDerivedGaugeValidback to summary
public final synchronized void setDerivedGaugeValid(boolean derivedGaugeValid)
setPreviousScanGaugeback to summary
public final synchronized void setPreviousScanGauge(Number previousScanGauge)
setStatusback to summary
public final synchronized void setStatus(int status)
setTypeback to summary
public final synchronized void setType(Monitor.NumericalType type)