From: Kris Jurka <books@ejurka.com>
To: Michael Barker <mike@middlesoft.co.uk>
Cc: pgsql-jdbc@postgresql.org
Cc: Andy Oliver <acoliver@jboss.org>
Subject: Re: [PATCH] Support for ping method.
Date: Mon, 17 Apr 2006 01:37:41 -0500 (EST)
Message-ID: <Pine.BSO.4.63.0604170115380.17202@leary2.csoft.net> (raw)
In-Reply-To: <1144305529.2955.11.camel@corona>
References: <1144305529.2955.11.camel@corona>
On Thu, 6 Apr 2006, Michael Barker wrote:
> Attached is a patch that adds support for a ping method on the
> AbstractJdbc2Connection. This is useful for JBoss (and other
> containers) where the container needs to check if the connection is
> alive before passing it to the caller. Currently JBoss does a "SELECT
> 1", but using the new ping method there is a boost in performance.
> Opening and closing 1000 connections from a datasource:
>
There are a number of problems with this patch. In no particular order...
1) publicly accessible postgresql specific functions should be exported
in the org.postgresql.PGConnection interface or similar. Client code
should not attempt to cast a connection to any other interface.
2) The ping method in QueryExecutorImpl must be synchronized to avoid
interfering with other threads use of the backend connection.
3) The error handling is non-existent. It swallows all kinds of errors
and leaves the protocol stream in an unknown state leaving the caller
responsible for cleanup. At worst it should close the connection and
throw some sort of exception.
4) It is possible that the first response from a Sync message on a
valid connection will not be a ReadyForQuery message. Consider the
case of asynchronous Notify messages appearing. These must be
processed by the driver as it waits for the ReadyForQuery
message to arrive.
5) It lacks V2 protocol support. While V2 does not have a Sync message,
it does have something similar. By sending a query of the empty string
you will receive an EmptyQuery message immediately that should not require
any significant backend processing.
Kris Jurka
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: books@ejurka.com, mike@middlesoft.co.uk, acoliver@jboss.org
Subject: Re: [PATCH] Support for ping method.
In-Reply-To: <Pine.BSO.4.63.0604170115380.17202@leary2.csoft.net>
References: <1144305529.2955.11.camel@corona> <Pine.BSO.4.63.0604170115380.17202@leary2.csoft.net>
* 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