本文介绍了SearchControls.setTimeLimit()是否处理​​读取超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个问题,对目录的LdapContext.search()有时会永远挂起.我尝试提供一个称为setTimeLimit(10000),SearchControls对象,但问题仍然存在.

I'm having an issue where an LdapContext.search() against a directory will occasionally hang forever. I tried supplying a SearchControls object for which I've called setTimeLimit(10000), but the issue still happens.

鉴于此,我现在的想法是SearchControls对象仅用作服务器的建议,如果没有数据包返回,则不会安排客户端读取超时.我环顾四周,但在班级文档中找不到任何措辞来明确证实这一点.

Given this, my thought now is that the SearchControls object is being used only as an advisory to the server and won't arrange a timeout on the client side read if no packets come back. I looked around but didn't find any wording in the class documentation to explicitly confirm this.

谁能证实我的猜测,即SearchControls不会安排客户端读取超时,以及在这种情况下是否应该使用com.sun.jndi.ldap.read.timeout保护我的客户端?

Can anyone confirm my guess that SearchControls will not arrange a client side read timeout, and whether I should instead be using com.sun.jndi.ldap.read.timeout to protect my client in this case?

推荐答案

您是对的. SearchControls.setTimeLimit()不控制套接字读取超时.有关更多信息,请参见 http://docs.oracle.com/javase/tutorial/jndi/newstuff/readtimeout.html

You are right. SearchControls.setTimeLimit () doesn't control socket read timeout. See more at http://docs.oracle.com/javase/tutorial/jndi/newstuff/readtimeout.html

这篇关于SearchControls.setTimeLimit()是否处理​​读取超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 15:26