问题
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