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:
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
|