Announcement Announcement Module
No announcement yet.
LDAPTemplate lookup timeout Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • LDAPTemplate lookup timeout

    Is there a way to set the timeout on an ldapTemplate lookup?
    I'm using an lookup because I know the exact DN, I know it is possible with an ldapTemplate search but I suspect a lookup is faster and I don't want to have to switch to a search for the sake of being able to set a timeout?
    Also does it make sence to have a timeout on a ldap lookup? If not how long will the app wait on a result and is it not bad practice to setup queries without being able to set a time out on them?

  • #2
    A timeout on an LDAP lookup doesn't make much sense. The lookup should return immediately, either returning the requested entry or throwing an exception stating that the DN doesn't exist.

    With searches it's another question. You can supply a time limit in the SearchControls you supply to a search. For that you'lll obviously need to use one of the overloaded search methods that takes a SearchControls parameter.


    • #3
      Timeouts on lookups should be available. The query certainly should return quickly, but a timeout would give the application protection against all sorts of problems - network problems, outages, ldap servers unavailable... Rather have a timeout exception than the program hang. Can support for this be added?

      Joe Kearney

      EDIT: my post was a little premature. On closer inspection, timeouts can be set as environment properties on the Context as com.sun.jndi.ldap.{read,connect}.timeout. The read timeout is in effect for all LDAP reads. This is separate from the search timeout passed in through SearchControls. Here, both timeouts are observed - that is, the shorter timeout wins.
      Last edited by joekearney; Feb 15th, 2008, 05:31 AM.