java MBean 和 MXBean 的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16275207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:29:25  来源:igfitidea点击:

Difference between MBean and MXBean

javajmxmbeans

提问by Denim Datta

I have the following questions regarding MBeanand MXBean:

我有以下关于MBeanMXBean 的问题

  1. What is the difference between MBeanand MXBean?
  2. What are the use cases for MBeanand MXBean?
  1. MBeanMXBean 有什么区别?
  2. MBeanMXBean的用例是什么?

采纳答案by Heiko Rupp

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

MXBeans 只是一种特殊的MBeans。主要区别在于MXBean限制数据类型,以便它们与潜在客户“更兼容”。

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

例如:aMBean可以公开数据类型的属性Foo。现在客户端也需要有这个类型Foo来理解这个属性。

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

MXBean试图限制数据类型的那些“已有” -java.lang.*等等。

See this tutorial

这个教程

回答by Christian Schlichtherle

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

MXBean 是一种 MBean,它被限制为开放类型,基本上是原始类型、字符串及其组合。由于这些限制,MXBean 可以在没有类加载的情况下使用,这使得它们甚至可以与非 Java 客户端互操作。您可以在此处找到规范:http: //docs.oracle.com/javase/7/docs/api/javax/management/package-summary.html#package_description

回答by user2704588

MBeans :

MBean:

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

可以是任何 java 对象,我们可以在其中使用方法存储/检索 Serializable/Externalizable 对象。

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.

根据对象中使用的设计模式,我们可以区分标准(静态)或动态。建议保持接口类名后缀为 MBean。

MXBeans :

MXBean :

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

仅引用一组预定义的类型。建议保持接口类名后缀为MXBean。实现动态或自定义JavaBean 的接口。

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

使用 MXBean,我们可以方便任何客户端使用 MBean。使用 MXBean 所需的其他详细信息。

Refer Here

参考这里

回答by Lingasamy Sakthivel

MBeanscan be any of java objects, in which we can store/retrive Serializable/Externalizableobjects 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

MBeans可以是任何 java 对象,我们可以在其中Serializable/Externalizable使用方法存储/检索对象。根据对象中使用的设计模式,我们可以区分标准(静态)或动态。建议保持接口类名后缀为MBean

MXBeansreference 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.

MXBeans仅引用一组预定义的类型。建议保持接口类名后缀为MXBean. 实现 Dynamic 或 cusotmized 的接口JavaBean。使用 MXBean,我们可以方便任何客户端使用 MBean。

Refer MBean vs MXBean

参考MBean 与 MXBean