From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Patch: implement login timeout support |
Date: | 2005-02-02 01:19:41 |
Message-ID: | 42002AAD.9080103@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
The attached patch implements basic login timeout support.
The approach I've taken is that when a login timeout is specified, the
actual connection attempt happens in a new thread. The original caller
blocks waiting for a result from that thread, and can time out as desired.
The driver will temporarily leak threads when timeouts actually occur.
The new connect thread always waits for the connection to complete or
fail, and won't exit until that happens.
There is one case where we could permanently leak threads: when the
login process blocks indefinitely (for example, if the specified port
accepts the connection and then does not respond to the startup packet
at all). To fix this requires more invasive changes than I'm willing to
do at the moment. We would need to be able to get at the protocol stream
to close it before the connection is fully established, but currently
all the connection logic is hidden in the JdbcNConnection ctor.
If no login timeout is specified, connections are established in the
normal way with no extra threads involved.
Barring objections, I'll apply this to CVS shortly.
-O
Attachment | Content-Type | Size |
---|---|---|
pgjdbc-login-timeout.txt | text/plain | 12.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2005-02-02 02:44:57 | Re: Patch: implement login timeout support |
Previous Message | Kris Jurka | 2005-02-01 19:29:05 | Re: Primary schema name prepended to database objects |