tags:

views:

808

answers:

1

I'm using javax naming to connect to an LDAP database. 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

+2  A: 

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. You can handle any exceptions due to a dropped connection by reconnecting and then re-performing the requested operation.

James A Wilson
I tend to agree. The assumption is that it's valid, the *Exception* is that it's not, and should be handled as such.
Spencer K
Yeah I agree and that's sort of how we have it right now, but there is this framework we need to shoehorn the code into ;)Thanks for the reply anyway, I guess maybe we can keep it like we have it now.
mac