Does SearchControls.setTimeLimit() handle read timeout?

时间秒杀一切 提交于 2020-01-23 13:05:16

问题


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.

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.

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?


回答1:


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



来源:https://stackoverflow.com/questions/16926012/does-searchcontrols-settimelimit-handle-read-timeout

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!