简体   繁体   中英

How to write java RMI callbacks or RMI Listener or bidirectional RMI

I am writing an RMI application.

I am able to perform RMI. Data are transferring between client and server via RMI.

Client should be always up to receive/updates the server side data.

Is it possible to have a listener which can transport or notify the data updates/modification from server to clients. I mean whenever data's are updated/modified at server side,client should be automatically updated. Please let me know, if there exist any RMI Call be listener which can be used for this task.

Also, what are all the security standards to be followed while performing RMI?

How can we update server side object via client? If i need to update the server side instance, can i update it using client?

Please guide me to achieve this.

An RMI callback is no different from an RMI server object, except that it is exported from the client instead of the server.

However it's usually an infeasible architecture due to client-side firewalls. And using a remote callback as a listener has major overheads that make it typically infeasible even within a LAN. You really don't want to do this.

The last part of your question is really about how to write a remote method call, for which you should consult the Oracle RMI Tutorial.

I work on a similar server side application. The way we handle it is, Client to Server communication is synchronous and via RMI (over HTTP). However, responses to the client from the server are sent via JMS messaging queue. Each client has a dedicated queue to which the client subscribes to. On client login the queue gets created and on logout the queue is destroyed. This way the client responses from the server are async in nature. The client responsiveness increases as well. Had the server responses being synchronous in nature, the client could have appeared frozen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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