Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.monitor
Class Monitor

    java.lang.Object
      javax.management.NotificationBroadcasterSupport
          javax.management.monitor.Monitor

All Implemented Interfaces:
  MBeanRegistration, MonitorMBean, NotificationBroadcaster, NotificationEmitter

Direct Known Subclasses:
  CounterMonitor, GaugeMonitor, StringMonitor

public abstract class Monitor
extends NotificationBroadcasterSupport
implements MonitorMBean, MBeanRegistration

The monitor service.

Revisions:

20020319 Adrian Brock:

- Notify using the object name and fix the notification payloads

Version:
  $Revision: 1.13.4.1 $
Author:
  Adrian Brock

Field Summary
`protected int` | `alreadyNotified` Deprecated. use `alreadyNotifieds`[0]
`protected int[]` | `alreadyNotifieds` The errors that have already been notified.
`protected static int` | `capacityIncrement` The amount by which arrays are incremented.
`protected String` | `dbgTag` Deprecated. No replacement.
`protected int` | `elementCount` The number of valid elements in the arrays.
`protected static int` | `OBSERVED_ATTRIBUTE_ERROR_NOTIFIED` An observed attribute error has been notified.
`protected static int` | `OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED` An observed attribute type error has been notified.
`protected static int` | `OBSERVED_OBJECT_ERROR_NOTIFIED` An observed object error has been notified.
`protected static int` | `RESET_FLAGS_ALREADY_NOTIFIED` Used to reset errors in `alreadyNotified`.
`protected static int` | `RUNTIME_ERROR_NOTIFIED` An observed attribute type error has been notified.
`protected MBeanServer` | `server` The server this service is registered in.

Constructor Summary
`Monitor()`

Method Summary
`void` | `addObservedObject(ObjectName object)` Add the object name of the MBean monitored.
`boolean` | `containsObservedObject(ObjectName object)` Checks whether the object name is monitored.
`long` | `getGranularityPeriod()` Retrieves the granularity period in milliseconds.
`String` | `getObservedAttribute()` Retrieves the name of the attribute monitored.
`ObjectName` | `getObservedObject()` Retrieves the object name of the MBean monitored.
`ObjectName[]` | `getObservedObjects()` Retrieves the object names of the MBeans monitored.
`boolean` | `isActive()` Tests whether this monitoring service is active.
`void` | `postDeregister()` This method is called by the MBeanServer after deregistration takes place.
`void` | `postRegister(Boolean registrationDone)` This method is called by the MBeanServer after registration takes place or when registration fails.
`void` | `preDeregister()` This method is called by the MBeanServer before deregistration takes place.
`ObjectName` | `preRegister(MBeanServer server, ObjectName objectName)` This method is called by the MBeanServer before registration takes place.
`void` | `removeObservedObject(ObjectName object)` Remove the object name of the MBean monitored.
`void` | `setGranularityPeriod(long period)` Sets the granularity period in milliseconds.
`void` | `setObservedAttribute(String attribute)` Sets the name of the attribute monitored.
`void` | `setObservedObject(ObjectName object)` Sets the object name of the MBean monitored.
`abstract void` | `start()` Starts the monitor.
`abstract void` | `stop()` Stops the monitor.
`String` | `toString()`

Methods inherited from class javax.management.NotificationBroadcasterSupport
`addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### capacityIncrement

    protected static final int capacityIncrement

  The amount by which arrays are incremented.

  See Also:
    Constant Field Values

### RESET_FLAGS_ALREADY_NOTIFIED

    protected static final int RESET_FLAGS_ALREADY_NOTIFIED

  Used to reset errors in `alreadyNotified`.

  See Also:
    Constant Field Values

### RUNTIME_ERROR_NOTIFIED

    protected static final int RUNTIME_ERROR_NOTIFIED

  An observed attribute type error has been notified.

  See Also:
    Constant Field Values

### OBSERVED_OBJECT_ERROR_NOTIFIED

    protected static final int OBSERVED_OBJECT_ERROR_NOTIFIED

  An observed object error has been notified.

  See Also:
    Constant Field Values

### OBSERVED_ATTRIBUTE_ERROR_NOTIFIED

    protected static final int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED

  An observed attribute error has been notified.

  See Also:
    Constant Field Values

### OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED

    protected static final int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED

  An observed attribute type error has been notified.

  See Also:
    Constant Field Values

### elementCount

    protected int elementCount

  The number of valid elements in the arrays.

### server

    protected MBeanServer server

  The server this service is registered in.

### alreadyNotified

    protected int alreadyNotified

  Deprecated. use `alreadyNotifieds`[0]

  The errors that have already been notified. REVIEW: Check

### alreadyNotifieds

    protected int[] alreadyNotifieds

  The errors that have already been notified.

### dbgTag

    protected String dbgTag

  Deprecated. No replacement.

Constructor Detail

### Monitor

    public Monitor()

Method Detail

### getGranularityPeriod

    public long getGranularityPeriod()

  Description copied from interface: `MonitorMBean`
  Retrieves the granularity period in milliseconds.

  The monitoring takes place once per granularity period.

  Specified by:
    `getGranularityPeriod` in interface `MonitorMBean`
  Returns:
    the granularity period.

### getObservedAttribute

    public String getObservedAttribute()

  Description copied from interface: `MonitorMBean`
  Retrieves the name of the attribute monitored.

  Specified by:
    `getObservedAttribute` in interface `MonitorMBean`
  Returns:
    the attribute monitored.

### getObservedObject

    public ObjectName getObservedObject()

  Description copied from interface: `MonitorMBean`
  Retrieves the object name of the MBean monitored.

  Specified by:
    `getObservedObject` in interface `MonitorMBean`
  Returns:
    the object name.

### getObservedObjects

    public ObjectName[] getObservedObjects()

  Description copied from interface: `MonitorMBean`
  Retrieves the object names of the MBeans monitored.

  Specified by:
    `getObservedObjects` in interface `MonitorMBean`
  Returns:
    the object names.

### isActive

    public boolean isActive()

  Description copied from interface: `MonitorMBean`
  Tests whether this monitoring service is active.

  Specified by:
    `isActive` in interface `MonitorMBean`
  Returns:
    true when the service is active, false otherwise.

### setGranularityPeriod

    public void setGranularityPeriod(long period)
                              throws IllegalArgumentException

  Description copied from interface: `MonitorMBean`
  Sets the granularity period in milliseconds.

  The monitoring takes place once per granularity period.

  The default value is 10 seconds.

  Specified by:
    `setGranularityPeriod` in interface `MonitorMBean`
  Parameters:
    `period` - the granularity period.
  Throws:
    `IllegalArgumentException` - when the period is not positive.

### setObservedAttribute

    public void setObservedAttribute(String attribute)
                              throws IllegalArgumentException

  Description copied from interface: `MonitorMBean`
  Sets the name of the attribute monitored.

  The default value is null.

  Specified by:
    `setObservedAttribute` in interface `MonitorMBean`
  Parameters:
    `attribute` - the attribute monitored.
  Throws:
    `IllegalArgumentException` - when the period is not positive.

### setObservedObject

    public void setObservedObject(ObjectName object)
                           throws IllegalArgumentException

  Description copied from interface: `MonitorMBean`
  Sets the object name of the MBean monitored.

  The default value is null.

  Specified by:
    `setObservedObject` in interface `MonitorMBean`
  Parameters:
    `object` - the object name.
  Throws:
    `IllegalArgumentException`

### addObservedObject

    public void addObservedObject(ObjectName object)
                           throws IllegalArgumentException

  Description copied from interface: `MonitorMBean`
  Add the object name of the MBean monitored.

  Specified by:
    `addObservedObject` in interface `MonitorMBean`
  Parameters:
    `object` - the object name.
  Throws:
    `IllegalArgumentException`

### removeObservedObject

    public void removeObservedObject(ObjectName object)

  Description copied from interface: `MonitorMBean`
  Remove the object name of the MBean monitored.

  Specified by:
    `removeObservedObject` in interface `MonitorMBean`
  Parameters:
    `object` - the object name.

### containsObservedObject

    public boolean containsObservedObject(ObjectName object)

  Description copied from interface: `MonitorMBean`
  Checks whether the object name is monitored.

  Specified by:
    `containsObservedObject` in interface `MonitorMBean`
  Parameters:
    `object` - the object name.
  Returns:
    true when it is monitored.

### start

    public abstract void start()

  Description copied from interface: `MonitorMBean`
  Starts the monitor.

  Specified by:
    `start` in interface `MonitorMBean`

### stop

    public abstract void stop()

  Description copied from interface: `MonitorMBean`
  Stops the monitor.

  Specified by:
    `stop` in interface `MonitorMBean`

### toString

    public String toString()

### preRegister

    public ObjectName preRegister(MBeanServer server,
                                  ObjectName objectName)
                           throws Exception

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

  The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

  Specified by:
    `preRegister` in interface `MBeanRegistration`
  Returns:
    the actual ObjectName to register this MBean with.
  Throws:
    `Exception` - for any error, the MBean is not registered.

### postRegister

    public void postRegister(Boolean registrationDone)

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer after registration takes place or when registration fails.

  Specified by:
    `postRegister` in interface `MBeanRegistration`
  Parameters:
    `registrationDone` - the MBeanServer passes true when the MBean was registered, false otherwise.

### preDeregister

    public void preDeregister()
                       throws Exception

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer before deregistration takes place.

  The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

  Specified by:
    `preDeregister` in interface `MBeanRegistration`
  Throws:
    `Exception`

### postDeregister

    public void postDeregister()

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer after deregistration takes place.

  Specified by:
    `postDeregister` in interface `MBeanRegistration`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.