Hello,

I'm new to the dev. list and don't have CVS access. My apologies if this is the wrong 
way to propose a patch, but I didn't want to check in code that'll probably break 
something else. This patch works for me. Your mileage will vary.

Reason for patch:
The disconnect() method of LdapClient.java depends on garbage collection. Java garbage 
collection is not frequent enough for heavy load testing and it's possible to easily 
overwhelm the number of connections to a LDAP server. In testing, I found that 1,099 
connections could be easily held open by fifty threads.

Suggested patch:
Force garbage collection on disconnect(). There's a client-side performance hit for 
this. However, it's nowhere near as significant as the server-side performance 
degradation from the aforementioned behavior. With the patch, each operation opens a 
connection, sends the operation, gets the results, and closes the connection. There 
really should be an option to keep a connection open for n+1 LDAP operations; however, 
this is a quick hack that works.

Actual code:
    public void disconnect() {
        try {
           dirContext.close();
           Runtime.getRuntime().gc();
           Runtime.getRuntime().runFinalization();
        } catch (Exception e) {
            log.error("Ldap client - ",e);
        }
    }

Regards,

Kayne McGladrey
AT&T Wireless

Reply via email to