Re: [PATCH] Support for ping method.

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: [PATCH] Support for ping method.
Дата
Msg-id Pine.BSO.4.63.0604170237370.30846@leary2.csoft.net
обсуждение исходный текст
Ответ на Re: [PATCH] Support for ping method.  (Kris Jurka <books@ejurka.com>)
Ответы Re: [PATCH] Support for ping method.  (Andrew Oliver <acoliver@jboss.org>)
Список pgsql-jdbc

> 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...
>

6) I'm not sure what guarantees ping is trying to make.  Is it solely
to ensure that the backend is still connected or is it to ensure that the
connection state is ready to receive new commands.  Consider the
following as the attached test case demonstrates:

conn.setAutoCommit(false);
conn.createStatement().execute("SELECT 1/0"); // Forces transaction abort
conn.ping(); // Returns 0 saying connection is "good".
conn.createStatement().execute("SELECT 1"); // Fails b/c in aborted txn.

If you need the stronger guarantee of transaction state validity then I
think you could try the V2 EmptyQuery attempt on the V3 protocol as well.

When JDK1.6 comes out I imagine that this will be replaced by the
Connection.isValid method which does not seem to require anything
beyond a current backend connection.

http://download.java.net/jdk6/docs/api/java/sql/Connection.html#isValid(int)

Kris Jurka

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: [PATCH] Support for ping method.
Следующее
От: Andrew Oliver
Дата:
Сообщение: Re: [PATCH] Support for ping method.