Alternatives to RMI

為{幸葍}努か 提交于 2020-04-06 05:08:37

问题


I have a small Java SE application, it´s practically a fat client sitting on top of a database. To further my Java skills, I decided to make a client-server application out of it. The server application communicates with the database and handles all kinds of lengthy operations, while the client application only receives the results, mostly ArrayLists of moderate length and primitives.

To this end, I started reading on RMI and did the Oracle tutorial, which I found surprisingly difficult to understand and even get to work.

Is there anything else I can use instead of RMI, without having to dive into JavaEE?


回答1:


One way I would suggest would be to use JSON as the format for data exchange. You can use GSON to convert the data from Java objects to JSON and back. The transport could be done directly on the HTTP protocol using REST. You can use Jersey as a REST server/client or roll your own (since you don't want to use JEE, which Jersey is part of).




回答2:


SIMON is as simple to use as RMI, but with fewer traps in the initial setup. It also has some advantages over RMI. Here is a simple hello-world example:

http://dev.root1.de/projects/simon/wiki/Sample_helloworld110




回答3:


I take it RMI = Remote Method Invocation ...

You can have a look at XMLRPC, JSONRPC, JMS, or if you want to roll your own, use JSON to POST messages and convert the JSON back to a java object on the other side using GSON (from Google) or setup RabbitMQ and use AMQP to submit and receive messages if you don't want to handle the POSTing yourself, Spring AMQP makes it fairly easy to do this.



来源:https://stackoverflow.com/questions/22628255/alternatives-to-rmi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!