简体   繁体   English

RMI多个客户端

[英]RMI multiple clients

Does RMI handles multiple clients by itself? RMI是否自己处理多个客户端? ie

  1. is it possible to use a server function by multiple clients at the same time? 是否可以同时使用多个客户端的服务器功能?
  2. if no, how can I do such a thing? 如果不是,我怎么能做这样的事情?
  3. if yes, how it works? 如果是的话,它是如何工作的? does it make a new thread for each call ? 它为每个电话创建一个新线程吗? if one clients blocks the function what would happen with the next client? 如果一个客户端阻止该功能,下一个客户端会发生什么? etc. 等等

yes

how it works? 这个怎么运作? does it make a new thread for each call? 它为每个电话创建一个新线程吗? if one clients blocks the function what would happen with the next client? 如果一个客户端阻止该功能,下一个客户端会发生什么? etc. 等等

It creates a thread for each client connection. 它为每个客户端连接创建一个线程。

If one client calls a synchronized method or one which blocks other calls, calls made by other threads will block until that call releases the resource. 如果一个客户端调用synchronized方法或阻止其他调用的方法,则其他线程发出的调用将阻塞,直到该调用释放资源。

It sounds like you already worked out the answers, do you have a more specific doubt? 听起来你已经找到了答案,你有更具体的疑问吗?

是的RMI确实处理多个客户端,但是您必须使服务器线程安全 ,如果多个客户端同时调用方法,RMI会将多个线程分派到单个服务器对象中,因此如果您的服务器不是线程安全的,您的应用程序将会失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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