From: Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp>
To: pgsql-jdbc@postgresql.org
Subject: proposal: setKeepAlive
Date: Fri, 08 Feb 2008 23:25:48 +0900
Message-ID: <47AC666C.9070704@oss.ntt.co.jp> (raw)
Hi,
The attached makes tcp-keep-alive enable. When PostgreSQL server gets down or
network gets down, client application can't receive any response from the server.
PostgreSQL server has GUC parameters: tcp_keepalives_* and statement_timeout,
but JDBC doesn't have such features. setQueryTimeout() is not implemented so
far, so setKeepAlive() is needed for above situation at the very least.
Best regards,
--
Toru SHIMOGAKI<shimogaki.toru@oss.ntt.co.jp>
NTT Open Source Software Center
Attachments:setKeepAlive.patch (text/plain, 827B) download
diff -cpr postgresql-jdbc-8.3-603.src-orig/org/postgresql/core/PGStream.java postgresql-jdbc-8.3-603.src/org/postgresql/core/PGStream.java
*** postgresql-jdbc-8.3-603.src-orig/org/postgresql/core/PGStream.java 2008-02-08 16:42:59.000000000 +0900
--- postgresql-jdbc-8.3-603.src/org/postgresql/core/PGStream.java 2008-02-08 21:29:38.000000000 +0900
*************** public class PGStream
*** 107,112 ****
--- 107,115 ----
// really need to.
connection.setTcpNoDelay(true);
+ // Enable tcp keep alive timer+ connection.setKeepAlive(true);+
// Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no>
pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192);
pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192);
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: shimogaki.toru@oss.ntt.co.jp
Subject: Re: proposal: setKeepAlive
In-Reply-To: <47AC666C.9070704@oss.ntt.co.jp>
References: <47AC666C.9070704@oss.ntt.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox