SearchControls.setTimeLimit() 是否处理读取超时?

2022-01-17 00:00:00 ldap java jndi

我遇到了一个问题,即针对目录的 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

相关文章