java - RMI服务器如何响应多个RMI客户端调用?

标签 java algorithm network-programming client-server rmi

我构建了一个基于 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/

相关文章:

java - 关于weblogic portlets功效的一个问题

java - 为什么关于 java 泛型有这么多挑剔的规则?

c - 以下算法的顺序是什么?

linux - 非阻塞 send()/write() 和待处理数据处理

Java 检查客户端 jar 服务器端的最安全方法

java - 卡 table 和作家屏障实际上是​​如何工作的?

java - 从Java中的匿名对象访问非静态对象

c++ - 如何在给定数组的任何子数组(任何大小)中找到最大值(或最小值)?

c++ - 给定一个整数 N,大于 N 且只有 0 或 1 的最小整数是多少?

linux - 安装路径上的处理速度