javax.management.monitor
Class StringMonitor

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.monitor.Monitor
              |
              +--javax.management.monitor.StringMonitor

public class StringMonitor

extends Monitor

implements StringMonitorMBean

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

A string monitor sends notifications as follows:

  • if the attribute value matches the string to compare value, a match notification is sent. The notify match flag must be set to true. Subsequent matchings of the string to compare values do not cause further notifications unless the attribute value differs from the string to compare value.
  • if the attribute value differs from the string to compare value, a differ notification is sent. The notify differ flag must be set to true. Subsequent differences from the string to compare value do not cause further notifications unless the attribute value matches the string to compare value.

Version:

1.13

Author:

Max Parlione, Maurizio Simeoni, Massimo Tarquini

See Also:

Serialized Form

Fields inherited from class javax.management.monitor.Monitor
alreadyNotified, dbgTag, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, OBSERVED_OBJECT_ERROR_NOTIFIED, RESET_FLAGS_ALREADY_NOTIFIED, RUNTIME_ERROR_NOTIFIED, server
 

 

Constructor Summary

StringMonitor()
    Default constructor
 

 

Method Summary

 java.lang.String getDerivedGauge()
    Gets the derived gauge.
 long getDerivedGaugeTimeStamp()
    Gets the derived gauge timestamp.
 MBeanNotificationInfo[] getNotificationInfo()
    Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the string monitor.
 boolean getNotifyDiffer()
    Gets the differing notification's on/off switch value.
 boolean getNotifyMatch()
    Gets the matching notification's on/off switch value.
 java.lang.String getStringToCompare()
    Gets the string to compare with the observed attribute.
 void setNotifyDiffer(boolean value)
    Sets the differing notification's on/off switch value.
 void setNotifyMatch(boolean value)
    Sets the matching notification's on/off switch value.
 void setStringToCompare(java.lang.String value)
    Sets the string to compare with the observed attribute.
 void start()
    Starts the string monitor.
 void stop()
    Stops the string monitor.
 
Methods inherited from class javax.management.monitor.Monitor
getGranularityPeriod, getObservedAttribute, getObservedObject, isActive, postDeregister, postRegister, preDeregister, preRegister, setGranularityPeriod, setObservedAttribute, setObservedObject
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

 

Constructor Detail

StringMonitor

public StringMonitor()

Default constructor

 

Method Detail

getDerivedGauge

public java.lang.String getDerivedGauge()

Gets the derived gauge.

Specified by:

getDerivedGauge in interface StringMonitorMBean

 

Returns:

The derived gauge.

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp()

Gets the derived gauge timestamp.

Specified by:

getDerivedGaugeTimeStamp in interface StringMonitorMBean

 

Returns:

The derived gauge timestamp.

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()

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

Overrides:

getNotificationInfo in class NotificationBroadcasterSupport

getNotifyDiffer

public boolean getNotifyDiffer()

Gets the differing notification's on/off switch value.

Specified by:

getNotifyDiffer in interface StringMonitorMBean

 

Returns:

true if the string monitor notifies when differing from the string to compare, false otherwise.

getNotifyMatch

public boolean getNotifyMatch()

Gets the matching notification's on/off switch value.

Specified by:

getNotifyMatch in interface StringMonitorMBean

 

Returns:

true if the string monitor notifies when matching the string to compare, false otherwise.

getStringToCompare

public java.lang.String getStringToCompare()

Gets the string to compare with the observed attribute.

Specified by:

getStringToCompare in interface StringMonitorMBean

 

Returns:

The string value.

setNotifyDiffer

public void setNotifyDiffer(boolean value)

Sets the differing notification's on/off switch value.

Specified by:

setNotifyDiffer in interface StringMonitorMBean

 

Parameters:

value - The differing notification's on/off switch value.

setNotifyMatch

public void setNotifyMatch(boolean value)

Sets the matching notification's on/off switch value.

Specified by:

setNotifyMatch in interface StringMonitorMBean

 

Parameters:

value - The matching notification's on/off switch value.

setStringToCompare

public void setStringToCompare(java.lang.String value)
                        throws java.lang.IllegalArgumentException

Sets the string to compare with the observed attribute. The internal algorithm is reset if it is active.

Specified by:

setStringToCompare in interface StringMonitorMBean

 

Parameters:

value - The string value.

 

Throws:

java.lang.IllegalArgumentException - The specified string to compare is null.

start

public void start()

Starts the string monitor. In case of an already running monitor, the method invocation is ignored

Overrides:

start in class Monitor

stop

public void stop()

Stops the string monitor.

Overrides:

stop in class Monitor