我构建了一个基于 RMI 客户端-服务器的文件下载器应用程序。在那方面,我不了解不同客户的工作。文件位于服务器端,RMI 在其端有等效的代理服务器(称为 stub )。我为此应用程序使用了 10 个客户端和 1 个服务器。
Question 1- My question is when multiple clients simultaneously make RMI invocation after lookup from the registry, in what order does client seed/provide them the file? Means the underlying serving algorithm ---
Is it Round Robin Algorithm OR FIFO algorithm OR some other
?
我无法弄清楚这一点,当我执行代码时,我只是看到各个文件正在同时下载,就好像文件正在复制而不是下载一样。
Question 2- How could a single server serve so many clients and in what order such that the files are getting simultaneously downloaded?
另外,我的服务器端方法没有同步,不需要同步!
最佳答案
Question 1- My question is when multiple clients simultaneously make RMI invocation after lookup from the registry, in what order does client seed/provide them the file?
不分先后顺序。它们都是同时进行的。
Means the underlying serving algorithm --- Is it Round Robin Algorithm
没有。
OR FIFO algorithm
没有。
OR some other?
没有。没有订购。
I am not able to figure this out, when I execute my code I just see that the respective files are being simultaneously downloaded as if files are being copied instead of downloading.
我不知道“复制而不是下载”是什么意思,但“同时”准确地描述了情况。
Question 2- How could a single server serve so many clients and in what order such that the files are getting simultaneously downloaded?
通过多线程,或者熟练使用多路复用 I/O,或者异步 I/O。没有指定。没有指定任何内容。您不能假设的一件事是它是单线程的并且以任何方式顺序化。
Also, my server side method isn't synchronised, there is no need of synchronisation!
另一个假设,同样完全无效。 RMI 规范中没有任何内容可以证明这一信念。您不能假设 RMI 远程对象是单线程的。
关于java - RMI服务器如何响应多个RMI客户端调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31851882/