Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-1583

ldap component is not thread safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.0, 2.0-M1
    • 1.6.1, 2.0-M2
    • camel-ldap
    • None
    • N/A

    Description

      JNDI context objects are not thread-safe. The LDAP component shares a directory context across all threads that use the component. This is not safe.

      In addition the LDAP component will attempt to establish a connection on instantiation of the component, and not when the component is required to process requests. If the LDAP server is not ready e.g. temporarily unavailable then the entire Camel application will stop.

      JNDI directory contexts should be established when a consuming thread needs it and should be released when the thread is finished with the component i.e.:

      ctx = new InitialDirContext(env);
      try {
        ...
      } finally {
        ctx.close();
      }
      

      The above will release the connection with the LDAP server as soon as possible. The existing component relies on JNDI to release the socket in its own time (several seconds later).

      Attachments

        1. LdapProducer.java.diff
          3 kB
          Christopher Hunt

        Activity

          People

            davsclaus Claus Ibsen
            huntc@internode.on.net Christopher Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: