directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Carlo.Acco...@ibs-ag.com>
Subject RE: sockets left established in connection.unBind() ?
Date Fri, 20 Sep 2013 02:28:11 GMT
Ok Thanks!	

-----Original Message-----
From: Emmanuel Lécharny [mailto:elecharny@gmail.com] 
Sent: Thursday, September 19, 2013 8:28 PM
To: users@directory.apache.org
Subject: Re: sockets left established in connection.unBind() ?

Le 9/20/13 12:03 AM, Carlo.Accorsi@ibs-ag.com a écrit :
> Using Api version M20.  We create connection like this:
>
> LdapConnection connection = new LdapNetworkConnection(config); // Bind 
> request settings BindResponse bindResponse = 
> connection.bind(bindRequest);
>
> After connection.bind() 5 sockets are created.
> One between the JVM and the remote ApacheDS host and 4 loopback sockets.
>
> If I call connection.close(); all 5 are cleaned up.
>
> If I call connection.unBind();
>
> The remote socket closes but the 4 loopback sockets remain open and do not close.
> After a while, the JVM runs out of sockets.
>
> The literature says if unbind()  is call explicitly we don't have to close().
> http://directory.apache.org/api/five-minutes-tutorial.html
>
> I want to close everything in the most graceful and orderly way.
>
> Right now I've changed the code to call both methods
>
> connection.unBind();
> connection.close();
>
> Should I need to do this or should I just call close() ? Thanks.

You should close(). Unbind() just does one thing : it wipes out everything that are stored
in the LDAP session when you did a Bind. The reason is that a bnd(à costs nothing compared
to establishing a connection to the server (opneing sockets etc).


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 

Mime
View raw message