MBeanRegistry (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.jmx

## Class MBeanRegistry

- java.lang.Object
- - org.apache.zookeeper.jmx.MBeanRegistry

-     public class MBeanRegistry
      extends Object

  This class provides a unified interface for registering/unregistering of zookeeper MBeans with the platform MBean server. It builds a hierarchy of MBeans where each MBean represented by a filesystem-like path. Eventually, this hierarchy will be stored in the zookeeper data tree instance as a virtual data tree.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DOMAIN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MBeanRegistry()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MBeanRegistry` | `getInstance()`
    `MBeanServer` | `getPlatformMBeanServer()` Return the underlying MBeanServer that is being used to register MBean's.
    `Set<ZKMBeanInfo>` | `getRegisteredBeans()`
    `String` | `makeFullPath(String prefix, String... name)` Generate a filesystem-like path.
    `protected String` | `makeFullPath(String prefix, ZKMBeanInfo bean)`
    `protected ObjectName` | `makeObjectName(String path, ZKMBeanInfo bean)` Builds an MBean path and creates an ObjectName instance using the path.
    `void` | `register(ZKMBeanInfo bean, ZKMBeanInfo parent)` Registers a new MBean with the platform MBean server.
    `static void` | `setInstance(MBeanRegistry instance)` Useful for unit tests.
    `void` | `unregister(ZKMBeanInfo bean)` Unregister MBean.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DOMAIN

          public static final String DOMAIN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MBeanRegistry

          public MBeanRegistry()

  - ### Method Detail

    - #### setInstance

          public static void setInstance(MBeanRegistry instance)

      Useful for unit tests. Change the MBeanRegistry instance
      Parameters:
        `instance` - new instance

    - #### getInstance

          public static MBeanRegistry getInstance()

    - #### getPlatformMBeanServer

          public MBeanServer getPlatformMBeanServer()

      Return the underlying MBeanServer that is being used to register MBean's. The returned MBeanServer may be a new empty MBeanServer if running through IKVM.

    - #### register

          public void register(ZKMBeanInfo bean,
                               ZKMBeanInfo parent)
                        throws JMException

      Registers a new MBean with the platform MBean server.
      Parameters:
        `bean` - the bean being registered
        `parent` - if not null, the new bean will be registered as a child node of this parent.
      Throws:
        `JMException`

    - #### getRegisteredBeans

          public Set<ZKMBeanInfo> getRegisteredBeans()

      Returns:
        a `Collection` with the `ZKMBeanInfo` instances not unregistered. Mainly for testing purposes.

    - #### unregister

          public void unregister(ZKMBeanInfo bean)

      Unregister MBean.
      Parameters:
        `bean` -

    - #### makeFullPath

          public String makeFullPath(String prefix,
                                     String... name)

      Generate a filesystem-like path.
      Parameters:
        `prefix` - path prefix
        `name` - path elements
      Returns:
        absolute path

    - #### makeFullPath

          protected String makeFullPath(String prefix,
                                        ZKMBeanInfo bean)

    - #### makeObjectName

          protected ObjectName makeObjectName(String path,
                                              ZKMBeanInfo bean)
                                       throws MalformedObjectNameException

      Builds an MBean path and creates an ObjectName instance using the path.
      Parameters:
        `path` - MBean path
        `bean` - the MBean instance
      Returns:
        ObjectName to be registered with the platform MBean server
      Throws:
        `MalformedObjectNameException`

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.