`
scanfprintf123
  • 浏览: 80263 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JMX Standard MBean

Go 
阅读更多

   As we metioned before, JMX has three types of MBean, and the standard MBean is the simplest MBean of them, the other two are Dynamic MBean and Model MBean which we will cover in later articles.

   However, a standard MBean must adhere to the following rules:

  • An MBean must be an concreate class.
  • An MBean must have a public constructor.
  • An MBean must implements an MBean interface which name must follows the name schema classNameMBean.
  • An MBean can only implements only a single MBean interface.

   Since Standard MBean is simple, there is not much to talk about it except for its MBean interface, now let's examine how its management interface forms.

   First, let's take a look at a simple case:

   #Diagram 1

     From the class diagram above, we could know that the MBean interface PrintableMBean composes the Printable class's management interface, and it exposes one attribute(Message) and one operation(print()), after we register a Printable instance in the MBean server, we can invoke its operation or set or get its attribute according to its management interface.

     And let's make it a little complexer,

#Diagram 2

 If we register the Readable instance in the MBean Server, what is its management interface? Still the same as PrintableMBean?If so, how about the following case?

#Diagram 3

   In fact, how to compose the management interface follows certain rules:

  1. It will examin all the interfaces which MBean implements directly.If one of them matches the naming schema classNameMBean, return this matched interface, otherwise goes to step2.
  2. For all the interfaces implemented by MBean directly, examin their super interfaces, that is the interfaces extended by the ones implemented by MBean directly, to check if one of them can matches the condition, if not, goes to step 3.
  3. Search from MBean's parent class if any, and repeat step 1 and step 2.

    The following diagram will help you get a better understand of the above rules:



 

   After learning the rules for composing the management interface, let's use it to examin an example:

   #Diagram 4

  

    What are the management interface of Printable and Readable respectively? For Readable instance, does its management interface contains 'Message' attribute and 'print()' operation? No, it won't. According to the rules of composing the management interface, once the suitable MBean interface is found, it will stop searching at once, not go searching with MBean's parent class any more. Therefore, the management interface of Readable only contains two operations: readFile(path:String) and copy(fromPath : String, toPath : String), that is because the suitable MBean interface of Readable is ReadableMBean interface which also contains the operation copy(fromPath : String, toPath : String). The management interface of Printable will leave to you as practice.

 

   And there is one more thing you should know about is that what will JMX take as an exposed attribute and what will JMX take as an exposed operation?

   #Diagram 5

 

  From the above MBean interface, how many attributes and operations are exposed? The answer is that three operations are exposed and only one attribute is exposed, it's readable and writable. The exposed attribute must follows JavaBean specification, its setter method must have one parameter and its return type must be void while its getter method must not have parameter and its return type must not be void. Like the + setMessage(msg : String) : void and + getMessage() : String  method shows. What if the setter method has two parameters like + setAge(int age1,int age2) : void, is it an exposed attribute? No, it isn't. It is an exposed operation. Got it?

  • 大小: 2.8 KB
  • 大小: 3.5 KB
  • 大小: 4.4 KB
  • 大小: 10.3 KB
  • 大小: 5.6 KB
  • 大小: 2.4 KB
0
0
分享到:
评论

相关推荐

    Java分布式应用学习笔记09JMX-MBean的介绍

    ### Java分布式应用学习笔记09JMX-MBean的介绍 #### MBean概念及作用 MBean,即Managed Bean,是在JMX(Java Management Extensions)框架中用于管理资源的一种特殊Java对象。通过MBean,可以方便地对应用程序进行...

    jmx 实例 rmi mbean

    在本实例中,我们重点关注的是如何使用Remote Method Invocation(RMI)来实现JMX的MBean管理。RMI是一种在Java平台上进行远程调用的技术,使得一个Java对象的方法可以在不同的Java虚拟机(JVM)之间被调用。结合JMX...

    JMX(一)-------MBean server

    1. **Standard MBean**: 这是最常见的MBean类型,通过在类上使用`@ManagedResource`注解,然后使用`StandardMBean`类进行包装,使普通Java类成为MBean。 2. **Dynamic MBean**: 动态MBean没有固定的管理接口,它的...

    JMX实用例子详解(包括各种Mbean)

    2. **MBean Server**:这是JMX架构的核心,它负责注册和管理MBeans,处理MBean之间的交互,并提供给管理工具访问MBeans的接口。 3. **管理工具(Management Tools)**:这些工具可以是图形界面的,也可以是命令行的...

    java JMX概述

    MBean可以分为三类:Standard MBean、Dynamic MBean和Open MBean。Standard MBean遵循特定的接口规范,Dynamic MBean则可以通过实现`MBeanInfo`接口动态地定义其属性和操作,而Open MBean则提供了一种类型安全的方式...

    面试官问我 JMX 了解不,我说:什么? - 知乎1

    JMX支持四种类型的MBean:Standard MBean、Dynamic MBean、Open MBean和Model MBean。 1. **Standard MBean**:是最简单、最常见的MBean类型,与普通的Java Bean类似,主要用于简单的管理和监控场景。例如,Java的`...

    jmx_examples.rar_Java 8_jmx_jmx examples_jmx main_jmx_examples

    - 压缩包中的例子可能包括创建不同类型的MBean(Standard MBean、Dynamic MBean等)、注册MBean到MBean Server、暴露和操作MBean属性、执行MBean方法以及处理MBean通知。 - 每个示例通常会展示如何创建一个简单的...

    jmx第一个学习例子

    JMX中有两种MBean类型:Standard MBean和Dynamic MBean。Standard MBean实现较为直接,适合开发阶段的项目;而Dynamic MBean则更加灵活,允许更精细的管理和监控能力,但实现相对复杂。 通过上述知识点的解析,我们...

    java利用JMX做出不一样的的JVM.docx

    MBean有四种类型:Standard MBean、Dynamic MBean、Open MBean和Model MBean。Standard MBean是最常见且最简单的形式,类似于普通的Java Bean。Dynamic MBean允许动态地获取和设置属性,适合于已存在的、不易转换为...

    JMX初学资料 初学者入门教程

    MBean主要有三种:Standard MBean、Dynamic MBean和Open MBean。Standard MBean通过接口定义其管理属性和操作,Dynamic MBean更灵活,可以在运行时动态定义其管理接口,而Open MBean则是为了跨Java平台的兼容性和互...

    jmx-jvm配置

    MBean可以分为三种类型:Standard MBean、Dynamic MBean和Open MBean。 2. **MBean Server**: MBean Server是JMX框架的核心,它负责注册、管理和查询MBeans,以及执行MBean的操作。 3. **Management Interface**: ...

    JMX in Action

    MBean有三种类型:Standard MBean、Dynamic MBean和Open MBean。Standard MBean通过接口定义其管理属性和操作;Dynamic MBean允许动态定义管理接口,灵活性更高;Open MBean则是为了支持更复杂的类型和数据结构而...

    《jmx技术介绍》配套源代码

    通过JMX连接器,外部客户端可以连接到MBean Server,获取MBean的信息或执行操作。 4. MBean Server: MBean Server是JMX的核心,它负责存储和管理MBeans。开发者可以自定义MBean Server,但通常使用Java提供的内置...

    JMX、MXBean学习

    MXBean是JMX中的一个特殊概念,它是标准MBean的扩展,旨在简化跨JVM边界传递数据的过程。MXBean接口定义了特定的命名规则和序列化机制,确保数据能够在不同的Java环境中安全地传输。MXBean的使用通常涉及到JConsole...

    jmx需要的jar包

    JMX支持三种类型的MBeans:Standard MBean、Dynamic MBean和Open MBean。 2. **MBean Server**:MBean Server是JMX架构中的核心组件,它负责注册MBeans、执行MBean操作、处理MBean之间的交互,并提供了一个集中式的...

    jmx学习资料

    MBeans分为三种类型:Standard MBean、Dynamic MBean和Open MBean。 2. **MBean Server**: MBean Server是JMX的核心组件,它负责注册MBeans、执行对MBeans的操作并处理MBeans之间的交互。它是管理域的中心,管理...

    JAVA JMX 学习资料

    JMX Connectors提供了连接到MBean Server的途径,有多种类型的连接器,如RMI(Remote Method Invocation)和JMXMP(JMX Message Protocol),用于远程管理。 6. **JConsole**: Java自带的JConsole是JMX的一个...

    JMX IN ACTION(七)

    【JMX IN ACTION(七)】章节探讨了JMX中的Model MBean,这是一种特殊类型的MBean,开发者无需编写MBean类。Model MBean是JMX规范定义的一部分,保证在所有符合JMX标准的代理中可用,它是一个通用的MBean,可以被实例...

    jmx-1.2.1(jmxri+jmxtools) jar

    4. **MBean类型**: MBeans有三种主要类型:Standard MBeans、Dynamic MBeans和Open MBeans。Standard MBeans定义了固定的接口和属性,Dynamic MBeans能够在运行时动态地添加或删除管理属性,而Open MBeans提供了更...

Global site tag (gtag.js) - Google Analytics