请问Ja​​va RMI的意义是什么? [英] the significance of java RMI please?

查看:80
本文介绍了请问Ja​​va RMI的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么人们使用RMI,或者什么时候应该使用RMI?我在oracle的网站上阅读了有关RMI的那些教程。但是它并没有提供足够的实际示例。

Why do people use RMI, or when should I use RMI? I read those tutorials about RMI on oracle's website.But it doesn't provides enough practical examples.

据我所知,软件应将其模块无关且分开。 。 RMI某种程度上似乎是与我高度耦合的一个例子。为什么这不是不好的编码习惯?我认为客户端应该只触发指令,而对象的所有实际操作都是由服务器完成的。

To my understanding, a software should have its modules as "unrelated and separated" as possible. RMI somehow seems to be an example of high coupling to me. Why is this not a bad coding practice? I thought the client should only fire instructions,whereas all the actually manipulations of the object were done by the server.

(我目前正在攻读计算机科学学士学位,并且经验不足,因此如果我理解错误的概念,请纠正我。)

(I am currently working towards a computer science bachelor degree and very inexperienced, so please correct me if I understand those concepts wrong.)

谢谢!

推荐答案

您真的不应该将RMI用于今天构建的任何应用程序,基本上是因为您刚刚布置的原因。

You really should not be using RMI for any application you build today, basically for the reasons you just laid out.

在某些情况下(分为传统应用程序或企业应用程序),您别无选择。

In some cases (diving into legacy or "enterprise" applications) you just have no choice.

但是,如果您要开始一个新项目,其他选项是:

However, if you are starting a new project, other options are:

与远程服务进行通信的实际标准。它的最大优点是重量轻且易于掌握该概念。

The de-facto standard for communicating to remote services. The biggest advantage it has it that it is lightweight and easy to grasp the concept.

从理论上讲,它需要比RMI进行更多的工作,因为您必须手动制作可用的URL,每个URL中可接受的动词等。实际上,我会说RMI的样板并不能真正帮助任何人。

In theory it should require more work than RMI because you have to manually craft the available URL's, accepted verbs in each URL etc. In practice, I would say that RMI's boilerplate does not really help anybody.

与Java互动, Jersey是一个出色的库编写自己的RESTful Web服务。

Sticking with java, Jersey is a brilliant library to write your own RESTful web services.

如果您希望使用Java的RESTful Web服务包含电池的解决方案,请 Dropwizard 为您提供了一个完整的服务器和框架,可以随时插入您的业务逻辑,并提供开箱即用的日志记录,数据库连接性,序列化,请求路由甚至度量。

If you want a batteries included solution for RESTful web services with java, Dropwizard by the nice guys at Yammer gives you a full server and framework ready to just plug in your business logic, and provides logging, database connectivity, serialization, request routing, and even metrics gathering out of the box.

与远程服务通信的先前标准。除非您有理由使用它,否则我会坚持使用REST。

The previous standard for communicating to remote services. Unless you have a reason to use it, I would stick to REST.

节俭会创建一个客户端和服务器存根,基本上可以完成许多工作。通信采用有效的二进制协议。它在Java世界中越来越流行,因为大数据字段中的许多开源项目都在使用它。例如,Cassandra,HBase(切换到Avro)。 Scrooge是一个Twitter项目,用于为Scala创建惯用的节俭存根。

Thrift will create a client and a server stub, basically doing much of the work. The communication is in an efficient binary protocol. It's gaining popularity in the Java world as it is used by many open source projects in the "Big Data" field. Examples, Cassandra, HBase (switching to Avro). Scrooge is a twitter project to create idiomatic thrift stubs for scala.

Akka是框架 Scala和Java的Actor模型。包括用于服务间通信的条款,并在后台处理许多细节。 I

Akka is framework that implements the Actor model for Scala and Java. Includes provisions for inter-service communication, and takes care of many of the details under the hood. I

根据您的需求,有些会比其他人更合适。

Depending on your needs, some will be more suitable than others.

这篇关于请问Ja​​va RMI的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆