如何关闭Java RMI连接 [英] how to close java RMI connection

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

问题描述

有人知道如何关闭客户端和服务器之间的Java RMI客户端连接,以使TCP连接真正关闭,而不仅仅是在超时之前进入等待状态.
现在,当我发送RMI请求时,我的应用程序会等待几秒钟,然后发送另一个RMI请求. Java RMI实现将重用TCP连接,不会为每个请求打开新的连接.我想强制它为每个请求打开一个新的TCP连接.

Does anyone know how to close a Java RMI client connection between client and server such that the TCP connection is really closed and not just put in a wait state before it times out.
Right now when I send an RMI request, my app waits a few seconds and sends another RMI request. The Java RMI implementation will reuse the TCP connection, it will not open a new connection for each request. I would like to force it to open a new TCP connection for each request.

推荐答案

AFAIK API不允许这样做,因为它级别太高.经过优化后,可以假定在大多数情况下建立连接后最好保持打开状态,因为此后不久便会进行后续调用.
AFAIK the API will not allow this as it is too high level. It has been optimised to assume that in most cases after making the connection it is better to keep it open as there will eb a subsequent call shortly afterwards.


这篇关于如何关闭Java RMI连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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