5.4 The MBeanServerDelegate MBean

Every MBeanServer implementation defines a domain named JMImplementation . This domain is reserved for use by JMX implementations and is guaranteed to contain at least one MBean of class javax.management.MBeanServerDelegate . In every JMX implementation this MBean, MBeanServerDelegate , has the same object name :

 JMImplementation:type=MBeanServerDelegate 

The MBeanServerDelegate MBean servers two purposes:

  1. It provides information about the MBeanServer implementation.

  2. It serves as a source of MBeanServer notifications.

The MBeanServer information is expressed as a set of String -valued attributes, which are listed in Table 5.1. The most significant of these attributes is MBeanServerId because this is the value used in MBeanServerFactory 's findMBeanServer() method.

The MBeanServerDelegate MBean's other purpose is to emit MBeanServer notifications when MBeans are registered with the MBeanServer and unregistered from the MBeanServer. The MBeanServerNotification class extends the base JMX Notification class with a method, getMBeanName() , that returns the object name of the MBean being registered or unregistered. The notification types jmx.mbean.registered and jmx.mbean.unregistered indicate whether the MBean named in MBeanServerNotification was registered or unregistered, respectively.

What does this feature mean for management applications? It gives them an opportunity to be much more dynamic than might otherwise be possible. Suppose, for example, we have an application that manages resources of type X. An essential aspect of that application would be setting up a standard monitoring configuration for all resources of type X in a system. If the system's type X resources are static and known a priori , then we can code that information into our application. Reality, however, especially in management applications, is seldom that convenient ; we need to be able to deal with systems that contain varying numbers of resources of type X and in which those resources come and go over time. If we add a listener for MBeanServerDelegateMBean 's MBeanServer notifications, our application can react appropriately when MBeans that represent resources of type X are added to or removed from the MBeanServer.

Table 5.1. Attributes That Express MBeanServer Information

Attribute

Type

Description

MBeanServerId

Read-only

A unique ID for the MBeanServer. The JMX specification does not specify a format for this string, so different implementations can and do use different formats ”for example, host name, time stamp, GUID. The only requirement is that the value be unique in a given JVM.

SpecificationName

Read-only

The full name of the specification on which the MBeanServer implementation is based. The value of this attribute must be Java Management Extensions .

SpecificationVersion

Read-only

The version of the JMX specification on which the MBeanServer implementation is based. As of this writing, the most recent specification is 1.1 Final Release .

SpecificationVendor

Read-only

The name of the vendor of the JMX specification on which the MBeanServer implementation is based. The value of this attribute must be Sun Microsystems .

ImplementationName

Read-only

The implementation name of the MBeanServer ”for example, Sun RI or TMX4J .

ImplementationVersion

Read-only

The implementation version of the MBeanServer.

ImplementationVendor

Read-only

The vendor name of the MBeanServer implementation ”for example, Tivoli Software or Sun Microsystems .



Java and JMX. Building Manageable Systems
Javaв„ў and JMX: Building Manageable Systems
ISBN: 0672324083
EAN: 2147483647
Year: 2000
Pages: 115

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net