RMI multiple clients

匆匆过客 提交于 2019-12-09 03:40:52

问题


Does RMI handles multiple clients by itself? i.e.

  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.

回答1:


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.

It sounds like you already worked out the answers, do you have a more specific doubt?




回答2:


Yes RMI does handles multiple clients, but you must make your server threadsafe , RMI will dispatch multiple threads into a single server object if multiple clients simultanuosly make methods call on it so if your server isn't threadsafe your application will fail.



来源:https://stackoverflow.com/questions/10370878/rmi-multiple-clients

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!