简体   繁体   English

JMX和RMI之间的区别

[英]Difference between JMX and RMI

What is the purpose of JMX and what is it used for? JMX的目的是什么?它用于什么? I have been scanning through some of the tutorials on JMX and all they do is register some Mbeans and invoke those Mbeans from jconsole. 我一直在浏览JMX上的一些教程,他们所做的只是注册一些Mbeans并从jconsole调用那些Mbeans。 If that is its purpose, then what is the difference between JMX and RMI (remote procedure call)? 如果这是它的目的,那么JMX和RMI(远程过程调用)之间有什么区别?

Thanks in advance! 提前致谢!

JMX架构。

Yes in JMX we register our objects in mbean server using the ObjectName and objectReference . 在JMX中,我们使用ObjectNameobjectReference在mbean服务器中注册对象。 We can then change attributes or invoke methods remotely. 然后我们可以远程更改属性或调用方法。

A connector makes a Java Management Extensions (JMX) technology MBean server accessible to remote Java technology-based clients.Many different implementations of connectors are possible. 连接器使Java Management Extensions(JMX)技术MBean服务器可供基于Java技术的远程客户端访问。许多不同的连接器实现都是可能的。 In particular, there are many possibilities for the protocol used to communicate over a connection between client and server.Some Connectors defined by the JMX Remote API specification are 特别是,用于通过客户端和服务器之间的连接进行通信的协议有很多种可能性。由JMX Remote API规范定义的一些连接器是

  • " RMI Connector ": This standard Remote Method Invocation (RMI) protocol must be supported by every implementation that conforms to the JMX Remote API standard. RMI连接器 ”:每个符合JMX Remote API标准的实现都必须支持此标准远程方法调用(RMI)协议。
  • " Generic Connector ": The JMX Remote API standard also defines an optional protocol based directly on TCP sockets, called the JMX Messaging Protocol (JMXMP). 通用连接器 ”:JMX远程API标准还定义了一个直接基于TCP套接字的可选协议,称为JMX消息传递协议(JMXMP)。 An implementation of the standard can omit the JMXMP connector, but must not omit the RMI connector. 标准的实现可以省略JMXMP连接器,但不能省略RMI连接器。 The Java SE platform does not include the optional JMXMP connector. Java SE平台不包含可选的JMXMP连接器。
  • " User-Defined Protocols ": A connector can also implement a protocol that is not defined in the JMX technology. 用户定义的协议 ”:连接器还可以实现JMX技术中未定义的协议。

If you look at the above architecture a connector provides full remote access to the MBeanServer API using various communication frameworks ( RMI, IIOP, JMS, WS-* … ), while an adaptor adapts the API to another protocol (SNMP, …) or to Web-based GUI (HTML/HTTP, WML/HTTP, …). 如果查看上面的体系结构,连接器使用各种通信框架( RMI, IIOP, JMS, WS-* … )提供对MBeanServer API的完全远程访问,而适配器则将API适配到另一个协议(SNMP, …)或者基于Web的GUI (HTML/HTTP, WML/HTTP, …).

Generally we use JMX connectors to connect to the MBean server but we can chose other connectors as well. 通常我们使用JMX连接器连接到MBean服务器,但我们也可以选择其他连接器。

To sum up JMX is an java technology and RMI is for Remote Method Invocation a Java specific implementation of a Remote Procedure Call interface which can be used in the JMX to communicated remotely. 总结JMX是一种Java技术,RMI用于远程方法调用,是远程过程调用接口的Java特定实现,可以在JMX中用于远程通信。

'Remote Procedure Call' is a distributed computing concept where a process running on one host can call a procedure on another remote host. “远程过程调用”是一种分布式计算概念,其中在一个主机上运行的进程可以调用另一个远程主机上的过程。 RMI in Java is one implementation of this concept. Java中的RMI是这一概念的一种实现。

MBeans are bean classes that can be registered with a JMX bus to listen to events arriving on the bus or to send events on the bus or to collect various sorts of data from the other participating Mbeans etc. It is most often used for health monitoring of application servers etc. It can check the number of active connections, amount of free memory and many other statistics to an analysis engine. MBean是bean类,可以使用JMX总线注册,以监听到达总线的事件或在总线上发送事件或从其他参与的Mbeans等收集各种数据。它最常用于健康监控它可以检查分析引擎的活动连接数,可用内存量和许多其他统计信息。 And yes, they can be invoked remotely using an RPC mechanism. 是的,可以使用RPC机制远程调用它们。 This is vital to its functioning as data collectors since in a cluster of application servers the data has to be fetched from all the collectors and collated at one place for analysis. 这对于其作为数据收集器的功能至关重要,因为在应用程序服务器集群中,必须从所有收集器获取数据并在一个地方进行整理以进行分析。

JMX is a generic API for publishing an interface to monitor the internals of a Java application ( A Java version of SNMP ). JMX是一个通用API,用于发布监视Java应用程序内部的接口(Java版本的SNMP)。

RMI is for Remote Method Invocation a Java specific implementation of a Remote Procedure Call interface, they are not related at all. RMI用于远程方法调用远程过程调用接口的Java特定实现,它们根本不相关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM