Re: SocketTimeout behaviour
I think that is the expected behavior.
You can always do a search for something to keep it active.
Also, remember that the LDAP server may close an inactive connection
based on the server's timeout.
-jim
On 10/1/2009 11:16 AM, discolo wrote:
>
> Hi all,
> This is my first post and I've been looking for a response inside the
> class files, google and also this forum, but I haven't found a
> response.
>
> I'm using the this API for adding connection timeouts to my ldap
> connections. My question comes when I use the setSocketTimeout method or
> LDAPConnection(timeout) constructor.
> Inside the code, the setSocketTimeout method in the Connection class
> sets the SoTimeout for the Socket object.
> The setSoTimeout in the Java 1.4 API says "...a read() call on the
> InputStream associated with this Socket will block for only this amount
> of time. If the timeout expires, a java.net.SocketTimeoutException is
> raised, though the Socket is still valid..."
>
> So... I understand that I can hold the connection active if I'm not
> doing any read, or any search, delete, and so on. I have a connection
> pool and I need some active connections to be reused.
>
> And my problem starts here. If I open a new connection
> ....
> LDAPConnection ldapConnection = new LDAPConnection(timeout);
> ldapConnection.connect(host, port);
> ....
>
> If the connection remains idle over the requested timeout, the
> connection gets closed.
>
> The question is... żIs this a Bug or is the correct behaviour?
>
> Thanks in advance!
> Discolo
>
>
|