The MBeanServer Interface

In this section, we will take a close look at the MBeanServer interface, which is used to communicate with the MBeanServer implementation. First we will present the interface in its entirety, then we will proceed to dissect the interface method by method, providing examples along the way. We will also take another look at the ObjectName class, which is critical in manipulating MBeans indirectly through the MBeanServer interface (the preferred means of doing so). We have already covered what you can do through a reference to the MBeanServer interface. Let’s now look more closely at this important interface. Example 6-2 shows the MBeanServer interface.

Example 6-2. The MBeanServer interface

package javax.management; public interface MBeanServer { public Object instantiate(String className) throws ReflectionException, MBeanException; public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException; public Object instantiate(String className, Object params[], String signature[]) throws ReflectionException, MBeanException; public Object instantiate(String className, ObjectName loaderName, Object params[], String signature[]) throws ReflectionException, MBeanException, InstanceNotFoundException; public ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException; public ObjectInstance createMBean(String ...

Get Java Management Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.