[英]Where is the stub instantiated in RMI
I am not sure where the instance of a stub for a remote object is created. 我不确定在哪里创建远程对象的存根的实例。 Is it created when registering it in the rmiregistry by calling calling Naming.bind ?
通过调用Naming.bind在rmiregistry中注册它时会创建它吗? This would make sense as the registry is also called via RMI.
这也很有意义,因为注册表也通过RMI调用。
But can't the stub also be created by calling UnicastRemoteObject.exportObject ? 但是也不能通过调用UnicastRemoteObject.exportObject创建存根吗?
This particular code snippet from oracle confused me: oracle的这个特定代码片段使我感到困惑:
Compute engine = new ComputeEngine();
Compute stub = (Compute) UnicastRemoteObject.exportObject(engine, 0);
String name = "Compute";
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
When using Naming.bind do I need to pass a stub or a remote object? 使用Naming.bind时,我是否需要传递存根或远程对象?
The stub is 存根是
When using
Naming.bind()
do I need to pass a stub or a remote object?使用
Naming.bind()
,我是否需要传递存根或远程对象?
Either. 要么 It doesn't matter, because of (2).
没关系,因为(2)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.