RMI java - 2 客户端 1 服务器中的竞争条件 [英] race condition in RMI java - 2 client 1 server

查看:44
本文介绍了RMI java - 2 客户端 1 服务器中的竞争条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在两个不同的进程中有两个客户端,它们通过 RMI 与服务器进行通信.

i have two clients in two different processes that communicate through RMI with the server.

我的问题是:如果两个客户端同时调用服务器的存根会发生什么?

my question is: what happends if both clients invoking the server's stub at the same time?

感谢您的时间,我

推荐答案

本教程 演示了 RMI 服务器的线程特性(参见任务 7.1).他们引用了 RMI 规范:

This tutorial demonstrates the threaded nature of RMI servers (see task 7.1). They quote from the RMI spec:

由 RMI 运行时调度的方法到远程对象实现(一个服务器)可能会或可能不会在一个单独的线程.呼叫始发来自不同客户 虚拟机器将以不同的方式执行线程.来自同一台客户端机器不保证每种方法将在单独的线程中运行

A method dispatched by the RMI runtime to a remote object implementation (a server) may or may not execute in a separate thread. Calls originating from different clients Virtual Machines will execute in different threads. From the same client machine it is not guaranteed that each method will run in a separate thread

因此来自不同客户端的调用将导致通过服务器中的不同线程执行.

so invocations from different clients will result in execution via different threads in the server.

这篇关于RMI java - 2 客户端 1 服务器中的竞争条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆