Question

I have the following questions regarding MBean and MXBean:

  1. What is the difference between MBean and MXBean?
  2. What are the use cases for MBean and MXBean?
Was it helpful?

Solution

MXBeans are just a special kind of MBeans. The main difference is that MXBean restrict the data types, so that they are "more compatible" with potential clients.

As example: a MBean can expose attributes of a data type Foo. Now the client also needs to have this type Foo to make sense of the attribute.

The MXBean tries to restrict the data types to those "already available" - java.lang.* etc.

See this tutorial

OTHER TIPS

MBeans :

Can be any of java objects, in which we can store/retrive Serializable/Externalizable objects using methods.

Based on the design pattern used in objects, we can differentiate either Standard(static) or Dynamic. Recommended to maintain Interface class name suffixed with MBean.

MXBeans :

reference only a pre-defined set of types. Recommended to maintain Interface class name suffixed with MXBean. Implements interface of Dynamic or customized JavaBean.

Using MXBean, We can facilitate any client to use MBeans. Additional details required to use MXBean.

Refer Here

An MXBean is an MBean which is constrained to open types, basically primitive types, Strings and compositions thereof. Due to these constraints, an MXBean can get used without class loading and that makes them interoperable even with non-Java clients. You can find the specification here: http://docs.oracle.com/javase/7/docs/api/javax/management/package-summary.html#package_description

MBeans can be any of java objects, in which we can store/retrive Serializable/Externalizable objects using methods. Based on the design pattern used in objects, we can differentiate either Standard(static) or Dynamic. Recommended to maintain Interface class name suffixed with MBean

MXBeans reference only a pre-defined set of types. Recommended to maintain Interface class name suffixed with MXBean. Implements interface of Dynamic or cusotmized JavaBean. Using MXBean, We can facilitate any client to use MBeans.

Refer MBean vs MXBean

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top