简体   繁体   中英

RMI Java multiple instances of the same RMI Server

We currently have a server that is creating a new thread for each request he gets, so basically the server gets data that he needs to save later.

Now we got the request to implement RMI where we can observe what kind of data is currently being saved.

How can I handle this the best way? Shall I make an RMI Server for each thread? Can I have multiple instances of the same service on the same address and let my observer register to all of them?

I'm using the google example for the RMI access: https://sites.google.com/site/jamespandavan/Home/java/sample-remote-observer-based-on-rmi#TOC-Running-the-server-client

You don't need a remote object per thread, because you won't even have visible threads. A remote object is already multi-threaded and already takes care of its own incoming connections. You will be throwing stuff away rather than adding.

You might need a remote object per client, if you wamt them to behave like sessions, but that's a different story.

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