简体   繁体   English

Java RMI IIOP 是否可以通过 Internet 工作?

[英]Does Java RMI IIOP work over internet?

I know that RMI is short on making connection outside LAN.我知道 RMI 在 LAN 外部建立连接方面存在不足。 I want to know if RMI IIOP can connect server client over internet.我想知道 RMI IIOP 是否可以通过 Internet 连接服务器客户端。 Is it possible?可能吗? If yes what are the possible solutions?如果是,有哪些可能的解决方案?

RMI works fine over the internet, it's TCP-based. RMI 在 Internet 上运行良好,它是基于 TCP 的。 I'd use KryoNet as an RMI implementation, personally.我个人会使用KryoNet作为 RMI 实现。 It's no-hassle, and extremely speedy.它没有麻烦,而且速度非常快。 The serialisation mechanism uses Kryo, which is one of the fastest general purpose serialisation libraries.序列化机制使用 Kryo,它是最快的通用序列化库之一。 Note that there may be issues with firewalls.请注意,防火墙可能存在问题。 However, you could easily have an RMI server that listens on port 80. This would be work fine (unless there is heavy packet snooping, I guess).但是,您可以轻松地拥有一个侦听端口 80 的 RMI 服务器。这可以正常工作(除非有大量的数据包侦听,我猜)。 An RMI server that works over HTTP is interesting too.在 HTTP 上工作的 RMI 服务器也很有趣。 Mmm.嗯。

Yes, but only if the ports are open at the firewall.是的,但前提是端口在防火墙处打开。 The advantage to using HTTP instead of RMI is that it can easily be passed through proxy servers.使用 HTTP 而不是 RMI 的优点是它可以很容易地通过代理服务器。

There's no particular advantage to using IIOP over the native RMI protocol JRMP, as far as Internet-wide usage is concerned.就 Internet 范围的使用而言,与本机 RMI 协议 JRMP 相比,使用 IIOP 没有特别的优势。

IIOP does gives you the ability to call your Java objects using non-Java based code, so if you want to support non-Java clients, you'll want to be thinking about IIOP or something more browser / JavaScript friendly like SOAP or XMLRPC. IIOP确实使您能够使用基于非 Java 的代码调用 Java 对象,因此如果您想支持非 Java 客户端,您将需要考虑 IIOP 或更多浏览器/JavaScript 友好,例如 Z4DE91F0FCB9CD3A0ABDZ16FCB9CD3A0ABB0

If you don't need to support non-Java clients, there's not much to recommend IIOP.如果您不需要支持非 Java 客户端,那么推荐 IIOP 的并不多。 With IIOP, you lose the distributed garbage collection that JRMP provides, so you'll have to decide when any RMI-published object should no longer be published.使用 IIOP,您将失去 JRMP 提供的分布式垃圾收集,因此您必须决定何时不再发布任何 RMI 发布的 object。

With JRMP, all you have to worry about manually managing are the RMI objects you bind to the RMI registry.使用 JRMP,您只需担心手动管理绑定到 RMI 注册表的 RMI 对象。 All other objects you publish will be automatically garbage collected once all references to them (both local and remote) are dropped.一旦删除了对它们的所有引用(本地和远程),您发布的所有其他对象将自动被垃圾收集。 If you use IIOP, you'll manually have to call PortableRemoteObject.unexportObject() when it's time to take them out of use.如果您使用 IIOP,则必须在停止使用它们时手动调用 PortableRemoteObject.unexportObject()。

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

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