Home » openjdk-7 » javax » management » monitor » [javadoc | source]
javax.management.monitor
abstract public class: Monitor [javadoc | source]
java.lang.Object
   javax.management.NotificationBroadcasterSupport
      javax.management.monitor.Monitor

All Implemented Interfaces:
    MonitorMBean, MBeanRegistration, NotificationEmitter

Direct Known Subclasses:
    CounterMonitor, GaugeMonitor, StringMonitor

Defines the part common to all monitor MBeans. A monitor MBean monitors values of an attribute common to a set of observed MBeans. The observed attribute is monitored at intervals specified by the granularity period. A gauge value (derived gauge) is derived from the values of the observed attribute.
Nested Class Summary:
static class  Monitor.ObservedObject   
enum class  Monitor.NumericalType  Enumeration used to keep trace of the derived gauge type in counter and gauge monitors. 
Field Summary
protected static final  int capacityIncrement    The amount by which the capacity of the monitor arrays are automatically incremented when their size becomes greater than their capacity. 
protected  int elementCount    The number of valid components in the vector of observed objects. 
protected  int alreadyNotified    Monitor errors that have already been notified.
     
    protected  int[] alreadyNotifieds   

    Selected monitor errors that have already been notified.

    Each element in this array corresponds to an observed object in the vector. It contains a bit mask of the flags #OBSERVED_OBJECT_ERROR_NOTIFIED etc, indicating whether the corresponding notification has already been sent for the MBean being monitored.

     
    protected  MBeanServer server    Reference to the MBean server. This reference is null when the monitor MBean is not registered in an MBean server. This reference is initialized before the monitor MBean is registered in the MBean server. 
    protected static final  int RESET_FLAGS_ALREADY_NOTIFIED    This flag is used to reset the alreadyNotifieds monitor attribute. 
    protected static final  int OBSERVED_OBJECT_ERROR_NOTIFIED    Flag denoting that a notification has occurred after changing the observed object. This flag is used to check that the new observed object is registered in the MBean server at the time of the first notification. 
    protected static final  int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED    Flag denoting that a notification has occurred after changing the observed attribute. This flag is used to check that the new observed attribute belongs to the observed object at the time of the first notification. 
    protected static final  int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED    Flag denoting that a notification has occurred after changing the observed object or the observed attribute. This flag is used to check that the observed attribute type is correct (depending on the monitor in use) at the time of the first notification. 
    protected static final  int RUNTIME_ERROR_NOTIFIED    Flag denoting that a notification has occurred after changing the observed object or the observed attribute. This flag is used to notify any exception (except the cases described above) when trying to get the value of the observed attribute at the time of the first notification. 
    protected  String dbgTag    This field is retained for compatibility but should not be referenced.
       
      final  List<ObservedObject> observedObjects    List of ObservedObjects to which the attribute to observe belongs. 
      static final  int THRESHOLD_ERROR_NOTIFIED    Flag denoting that a notification has occurred after changing the threshold. This flag is used to notify any exception related to invalid thresholds settings. 
      static final  Integer INTEGER_ZERO    Constant used to initialize all the numeric values. 
      Method from javax.management.monitor.Monitor Summary:
      addObservedObject,   buildAlarmNotification,   buildErrorNotification,   classForType,   computeAlreadyNotifiedIndex,   containsObservedObject,   createAlreadyNotified,   createObservedObject,   doStart,   doStop,   getAttribute,   getComparableFromAttribute,   getDerivedGauge,   getDerivedGaugeFromComparable,   getDerivedGaugeTimeStamp,   getGranularityPeriod,   getObservedAttribute,   getObservedObject,   getObservedObject,   getObservedObjects,   isActive,   isAlreadyNotified,   isComparableTypeValid,   isThresholdTypeValid,   isValidForType,   onErrorNotification,   postDeregister,   postRegister,   preDeregister,   preRegister,   removeObservedObject,   resetAllAlreadyNotified,   resetAlreadyNotified,   setAlreadyNotified,   setGranularityPeriod,   setObservedAttribute,   setObservedObject,   start,   stop,   updateAlreadyNotified,   updateDeprecatedAlreadyNotified
      Methods from javax.management.NotificationBroadcasterSupport:
      addNotificationListener,   getNotificationInfo,   handleNotification,   removeNotificationListener,   removeNotificationListener,   sendNotification
      Methods from java.lang.Object:
      clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
      Method from javax.management.monitor.Monitor Detail:
       public synchronized  void addObservedObject(ObjectName object) throws IllegalArgumentException 
        Adds the specified object in the set of observed MBeans, if this object is not already present.
       MonitorNotification buildAlarmNotification(ObjectName object,
          String attribute,
          Comparable<?> value) 
       String buildErrorNotification(ObjectName object,
          String attribute,
          Comparable<?> value) 
       static Class<Number> classForType(NumericalType type) 
       synchronized int computeAlreadyNotifiedIndex(ObservedObject o,
          int index,
          int[] an) 
        Check if the #alreadyNotifieds array has been modified. If true recompute the index for the given observed object.
       public synchronized boolean containsObservedObject(ObjectName object) 
        Tests whether the specified object is in the set of observed MBeans.
       synchronized  void createAlreadyNotified() 
       ObservedObject createObservedObject(ObjectName object) 
        Factory method for ObservedObject creation.
        void doStart() 
        Starts the monitor.
        void doStop() 
        Stops the monitor.
       Object getAttribute(MBeanServerConnection mbsc,
          ObjectName object,
          String attribute) throws AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException, IOException 
       Comparable<?> getComparableFromAttribute(ObjectName object,
          String attribute,
          Object value) throws AttributeNotFoundException 
       synchronized Object getDerivedGauge(ObjectName object) 
        Gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
       Comparable<?> getDerivedGaugeFromComparable(ObjectName object,
          String attribute,
          Comparable<?> value) 
       synchronized long getDerivedGaugeTimeStamp(ObjectName object) 
        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 getGranularityPeriod() 
        Gets the granularity period (in milliseconds).
        The default value of the granularity period is 10 seconds.
       public synchronized String getObservedAttribute() 
        Gets the attribute being observed.
        The observed attribute is not initialized by default (set to null).
       public synchronized ObjectName getObservedObject() 
      Deprecated! As - of JMX 1.2, replaced by #getObservedObjects

        Returns the object name of the first object in the set of observed MBeans, or null if there is no such object.
       synchronized ObservedObject getObservedObject(ObjectName object) 
        Get the specified {@code ObservedObject} if this object is contained in the set of observed MBeans, or {@code null} otherwise.
       public synchronized ObjectName[] getObservedObjects() 
        Returns an array containing the objects being observed.
       public synchronized boolean isActive() 
        Tests whether the monitor MBean is active. A monitor MBean is marked active when the start method is called. It becomes inactive when the stop method is called.
       synchronized boolean isAlreadyNotified(ObservedObject o,
          int mask) 
       boolean isComparableTypeValid(ObjectName object,
          String attribute,
          Comparable<?> value) 
       boolean isThresholdTypeValid(ObjectName object,
          String attribute,
          Comparable<?> value) 
       static boolean isValidForType(Object value,
          Class<Number> c) 
        void onErrorNotification(MonitorNotification notification) 
       public  void postDeregister() 
        Allows the monitor MBean to perform any operations needed after having been unregistered by the MBean server.

        Not used in this context.

       public  void postRegister(Boolean registrationDone) 
        Allows the monitor MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

        Not used in this context.

       public  void preDeregister() throws Exception 
        Allows the monitor MBean to perform any operations it needs before being unregistered by the MBean server.

        Stops the monitor.

       public ObjectName preRegister(MBeanServer server,
          ObjectName name) throws Exception 
        Allows the monitor MBean to perform any operations it needs before being registered in the MBean server.

        Initializes the reference to the MBean server.

       public synchronized  void removeObservedObject(ObjectName object) 
        Removes the specified object from the set of observed MBeans.
       synchronized  void resetAllAlreadyNotified(ObservedObject o,
          int index,
          int[] an) 
       synchronized  void resetAlreadyNotified(ObservedObject o,
          int index,
          int mask) 
       synchronized  void setAlreadyNotified(ObservedObject o,
          int index,
          int mask,
          int[] an) 
       public synchronized  void setGranularityPeriod(long period) throws IllegalArgumentException 
        Sets the granularity period (in milliseconds).
        The default value of the granularity period is 10 seconds.
       public  void setObservedAttribute(String attribute) throws IllegalArgumentException 
        Sets the attribute to observe.
        The observed attribute is not initialized by default (set to null).
       public synchronized  void setObservedObject(ObjectName object) throws IllegalArgumentException 
      Deprecated! As - of JMX 1.2, replaced by #addObservedObject

        Removes all objects from the set of observed objects, and then adds the specified object.
       abstract public  void start()
        Starts the monitor.
       abstract public  void stop()
        Stops the monitor.
       synchronized  void updateAlreadyNotified(ObservedObject o,
          int index) 
        Update the #alreadyNotifieds array element at the given index with the already notified flag in the given {@code ObservedObject}. Ensure the deprecated #alreadyNotified field is updated if appropriate.
       synchronized  void updateDeprecatedAlreadyNotified()