简体   繁体   English

检查LDAP连接(Java)

[英]Check LDAP connection (Java)

I'm using javax naming to connect to an LDAP database. 我正在使用javax命名来连接到LDAP数据库。 Is there a good way to check if a connection is still valid? 有没有一种好的方法来检查连接是否仍然有效? I'm looking for something really efficient here because it may need to be done often. 我在这里寻找真正有效的方法,因为它可能需要经常进行。

After some web searching all I have found is a suggestion to do a quick search, is there any more lightweight way? 在进行一些网络搜索之后,我发现建议您进行快速搜索,还有没有更简便的方法?

/mac /苹果电脑

Is there a reason you can't just assume it is still valid? 您是否有理由不能仅仅假设它仍然有效? That seems the most efficient. 这似乎是最有效的。 Encapsulate the LDAP communication in a class. 将LDAP通信封装在一个类中。 You can handle any exceptions due to a dropped connection by reconnecting and then re-performing the requested operation. 您可以通过重新连接然后重新执行请求的操作来处理由于连接断开而引起的任何异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM