开发者

Server-client Java distributed application

I have to design a distributed applicat开发者_开发问答ion composed by one server (developed in Java) and one or more remote GUI clients (Swing application with windows).

As stated before the clients are Swing GUI application that can connect to the server in order to receive and send data. The communication is bidirectional (Server <=> Clients). Data sent over the network is mainly composed by my domain logic objects.

Two brief examples: a client calls the server in order to receive data to populate a table inside a window; the server calls client in order to send data to refresh a specific widget (like a button).

The amount of data transmitted between server and clients and the frequency of the network calls are not particularly high.

Which technology do you suggest me for the server-clients communication?

I've in mind one technology suitable for me but I would like to know your opinions.

Thanks a lot.


The first technology that came to my mind was RMI - suitable if you're communicating between java client and java server. But you may get difficulties if you want do switch the client technology to - say - a webinterface.


I would go with RMI but implement the whole architecture using Spring framework. This way it is independent of technology used and can be switched to other ways of communication (such as HTTP or other ) with almost no coding.

UPDATE: And Spring will allow you to have none of RMI specific code.


I believe sockets should do the trick. They are flexible and not especially hard to code/maintain. Most entry level programmer should also be able to maintain them. They are also fast and adapt to any kind of environment.

Unless, your server is going to be off-site or you expect to have firewall issues. In that case, web services are the way to go since your basic communication happens through port 80.


I would second msparer's suggestion of RMI, except I would just use EJB3 (which uses RMI as the communication protocol). EJB3 are very easy and even if you don't use the other feaures EJB gives you (e.g., security) you can still leverage Container Managed Transactions (CMT). It really does make development easy.

As for the server->client communication, you would probably want to use JMS. Again, using EJB3 this is pretty e3asy to do with annotations. The clients will subscribe to the message service and receive update notifications from the server.

And yes, I am currently working on an application that does this very thing. Unfortunately we are using EJB2.1. Still, it is my opinion that this is where EJBs really shine. Using EJBs in a web app is frequently overkill, but in a distributed client/server app they work very well.


You can try using ICE http://www.zeroc.com for establishing server-client connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜