Re: Connection Pool Timeout

From: Kris Jurka <books(at)ejurka(dot)com>
To: "Marcus Andree S(dot) Magalhaes" <marcus(dot)magalhaes(at)vlinfo(dot)com(dot)br>
Cc: <nhm(at)mimecast(dot)net>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Connection Pool Timeout
Date: 2004-01-11 23:04:12
Message-ID: Pine.LNX.4.33.0401111757440.5953-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sun, 11 Jan 2004, Marcus Andree S. Magalhaes wrote:
> > The other problem is actually enforcing this connection timeout when
> > creating a real connection. As far as I can see there is no means
> > before the 1.4 jvm to put a timeout value on creating a Socket
> > connection. Then for the whole connection and authentication process you
> > would need to call setSoTimeout on the Socket. This would be incredibly
> > ugly because to enfore a setLoginTimeout of 4 seconds you couldn't
> > simply use a 4 second timeout on the socket's read and write calls
> > because each one of many could take 3.9 seconds. You would have to
> > continually monitor the time elapsed and keep calling setSoTimeout with
> > the remaing time left.
> >
> > Kris Jurka
> >
>
> Kris, checking Sun's javadoc pages, it seemes that setSoTimeout and
> setSoLinger is abailable since jdk 1.1. My guess is, if anyone wants
> to provide a solution to this "problem", the best answer would be to
> use both the loop limit and socket timeouts.

setSoTimeout is only for read() calls on the InputStream, it won't help us
during establishing a connection.

setSoLinger is only relevent for closing the connection which isn't
related to setLoginTimeout.

The idea of continually setting setSoTimeout with the remaining time left
is something I mentioned as the only way I saw to do it, not something I
would want to consider actually doing.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-01-11 23:04:36 Re: Multi-dimensional array support
Previous Message Marcus Andree S. Magalhaes 2004-01-11 22:44:05 Re: Connection Pool Timeout