gpt4 book ai didi

java - RMI 客户端上有 stub 类的目的是什么?

转载 作者:行者123 更新时间:2023-12-02 13:24:50 24 4
gpt4 key购买 nike

将 stub 类动态加载到 RMI 客户端有什么意义?充当远程对象代理的 stub 被客户端用来调用远程方法,但是如果我们加载 stub 类,我们就在客户端 VM 中拥有该类。由于客户端拥有整个 stub 类,这难道不会使它像本地方法调用吗?

Dynamic class loading RMI

最佳答案

What is the point of dynamically loading the stub class onto the RMI client?

它简化了部署问题。您不必分发 stub 类。由于动态 stub 是在 Java 1.5 中引入的,因此动态 stub 加载的重要性逐渐减弱。

Doesn't this make it like a local method call, since the client has the entire stub class?

当然可以,但是 stub 类中被调用的方法会使用 RMI 网络协议(protocol)将其委托(delegate)给远程对象。

关于java - RMI 客户端上有 stub 类的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43432045/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com