gpt4 book ai didi

java - RMI:注册表安全问题

转载 作者:太空宇宙 更新时间:2023-11-04 12:21:41 26 4
gpt4 key购买 nike

假设我有以下代码:

class Foo implements FooRemote{
private String string;
}

class Boo implements BooRemote{
/**
* This method is directly called from RMI client only
*/
public Foo getMyFoo(){
Foo foo=new Foo();
UnicastRemoteObject.exportObject(foo,somePort);
return foo;//the reference is returned directly to client
}
}

如您所见,我无论如何都没有将其添加到注册表中,例如我没有这样做:

registry.rebind(url, fooStub);

我能否 100% 确定在所有 RMI 客户端中,对创建的 foo 的每个实例的访问将只有一个客户端(调用该方法的人),并且其他任何人都无法获取对此对象的引用(通过注册表或其他方式)并使用它?

附注请在您的答案中注明

最佳答案

Can I be 100% sure that among all RMI clients the access to each instance of created foo will have only one client (that, who called that method) and no one else can get the reference to this object (via registry or somehow else) and use it?

是的。它不在注册表中,因为您没有将其放在那里。唯一可见的引用是您返回给客户端的引用。

关于java - RMI:注册表安全问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38804420/

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