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
Difference between MBean and MXBean
提问by Denim Datta
I have the following questions regarding MBeanand MXBean:
我有以下关于MBean和MXBean 的问题:
- What is the difference between MBeanand MXBean?
- What are the use cases for MBeanand MXBean?
- MBean和MXBean 有什么区别?
- MBean和 MXBean的用例是什么?
采纳答案by Heiko Rupp
MXBean
s are just a special kind of MBean
s. The main difference is that MXBean
restrict the data types, so that they are "more compatible" with potential clients.
MXBean
s 只是一种特殊的MBean
s。主要区别在于MXBean
限制数据类型,以便它们与潜在客户“更兼容”。
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.
例如:aMBean
可以公开数据类型的属性Foo
。现在客户端也需要有这个类型Foo
来理解这个属性。
The MXBean
tries 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 所需的其他详细信息。
回答by Lingasamy Sakthivel
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
MBeans
可以是任何 java 对象,我们可以在其中Serializable/Externalizable
使用方法存储/检索对象。根据对象中使用的设计模式,我们可以区分标准(静态)或动态。建议保持接口类名后缀为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.
MXBeans
仅引用一组预定义的类型。建议保持接口类名后缀为MXBean
. 实现 Dynamic 或 cusotmized 的接口JavaBean
。使用 MXBean,我们可以方便任何客户端使用 MBean。
Refer MBean vs MXBean