You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Ca...@ibs-ag.com on 2013/09/20 00:03:39 UTC

sockets left established in connection.unBind() ?

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.



RE: sockets left established in connection.unBind() ?

Posted by Ca...@ibs-ag.com.
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 


Re: sockets left established in connection.unBind() ?

Posted by Emmanuel Lécharny <el...@gmail.com>.
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