关闭 rmi 注册表 [英] closing rmi registry

查看:63
本文介绍了关闭 rmi 注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 RMI 将 String 对象从 WebAppA 传递到 WebAppB.WebAppB 是 RMIServer,而 WebAppA 是 RMIClient.我在 WebAppB 中添加了 ContextListener,以便在 tomcat 中初始化上下文时立即启动 rmi 服务.并且在 contextDestroyedtomcat 的方法我正在尝试使用以下语句关闭/关闭 rmi:

Using RMI to pass String object from WebAppA to WebAppB.WebAppB is the RMIServer whereas WebAppA is RMIClient.I have added ContextListener in WebAppB, so that the rmi service starts right away when the context is initialized in tomcat.And in the contextDestroyed method of tomcat I am trying to close/shut down rmi using the following statements:

unexportObject(remoteObj,true);
LocateRegistry.getRegistry(3232).unbind("MessagePath"); //MessagePath - name of the remote reference

但即使在执行上述语句后,rmi 仍在侦听端口 3232 的传入请求.我在命令提示符中使用netsat -ano"看到了这一点.请帮我关闭 RMI 服务.

But even after the execution of the aforeseen statements, rmi is listening for incoming requests at port 3232.I saw that by using "netsat -ano" in command prompt.Please do help me to close RMI Service.

推荐答案

getRegistry 只返回一个存根,所以在 unexportObject 中使用 createRegistry 返回的实例.但是,在我的情况下,这也无济于事-注册表不再处于活动状态,但套接字仍处于打开状态并在侦听:-(

getRegistry returns a stub only, so use the instance returned by createRegistry in unexportObject. However in my case this does not help either - the registry is not active anymore, but the sockets are still open and listening :-(

这篇关于关闭 rmi 注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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