检查对象是否仍绑定到 NameService (tnameserv)

发布于 2024-11-02 12:21:32 字数 101 浏览 1 评论 0原文

有没有一种简单的方法来检查对象是否仍然绑定到“tnameserv”? 绑定对象后,“tnameserv”进程可能会崩溃、被杀死……并且我希望我的应用程序验证我之前绑定的对象是否仍然被绑定。

Is there an easy way to check whether an object is still bound to a "tnameserv" ?
After you bind an object, the "tnameserv" process might crash, be killled, ... and I want my application to verify whether an object that I bound earlier is still bound.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白衬杉格子梦 2024-11-09 12:21:32

假设您使用的是 Oracle Java ORB ,为什么不使用他们提供的持久名称服务而不是瞬态 tnameserv?听起来您的应用程序需要持久注册引用,因此尝试从瞬态命名服务获得类似持久的行为可能会是一个死胡同。

顺便说一句,您可以使用任何供应商的 COS 命名服务,而不仅仅是 Oracle 提供的服务(甚至不必用 Java 编写)。例如,免费的 JacORB 名称服务器可以在持久模式下运行,允许您注册的引用在重新启动后继续存在或服务崩溃。

无论如何,您问题的答案取决于您是从客户端还是服务器的角度提出问题。使用命名服务的服务器不需要检查是否已在其中注册了自己的现有引用 - 它应该只调用 rebind() 来更新注册。如果其中还没有任何内容,则会添加参考。如果其中有一个,它将被新值覆盖。

如果您从客户的角度询问这个问题,您应该记住命名服务就像电话簿。如果客户端没有在那里找到它需要的注册,那么它几乎就一事无​​成,除非它能找到其他合适的对象来提供您需要的服务。最好让你的客户在此时失败,而不是试图猜测如何弥补真正的灾难性情况。

Assuming you're using the Oracle Java ORB, why not use the persistent name service which they provide rather than the transient tnameserv? It sounds like your application needs a persistent registration of references, so trying to get persistent-like behavior from a transient naming service will likely be a dead-end.

BTW you can use any vendor's COS Naming Service, and not just the one provided by Oracle (nor does it even have to be written in Java, either). For example, the free JacORB Name Server can run in a persistent mode, allowing the references you register to survive a restart or crash of the service.

In any case, the answer to your question depends on whether or not you're asking it from the client's or server's perspective. A server using the Naming Service shouldn't need to check that there's an existing reference of its own already registered in there - it should instead just call rebind() to update the registration. If there's nothing in there already, the reference will be added. If there's one in there, it will get overwritten with the new value.

If you're asking about this from your client's perspective, you should remember that the Naming Service is like a phone book. If the client doesn't find a registration in there that it requires, it's pretty much dead in the water unless it can find other suitable objects which could be used to provide the services you need. It's probably better to have your client fail at that point rather than try to guess at how to compensate for what is really a catastrophic scenario.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文