Re: setQueryTimeOut

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: setQueryTimeOut
Дата
Msg-id Pine.BSO.4.56.0410291812150.16598@leary.csoft.net
обсуждение исходный текст
Список pgsql-jdbc

On Wed, 27 Oct 2004, Oezcan Acar wrote:

> do you now something new about the implementation of
> Statement.setQueryTimeOut ? As far as I now this method is not
> implemented in the current driver. Do you know, how to implement such a
> method? Thank you.
>

There are two ways to approach this problem.  With the backend's
statement_timeout config variable and the driver's Statement.cancel()
method.  The issue with both of these is that you need to be concerned
about thread safety and only cancelling the correct statement.

Using the backend's statement_timeout is pretty straightforward, before
each query set it and after each query reset it.  Issues to be careful of
are making sure the timeout gets reset on errors.  I would also be
concerned about the potential overhead of issuing two additional queries
for each user level statement execution.

With the Statement.cancel approach you would create a new thread to wake
up and issue the cancel if the statement hasn't completed yet, but I
believe there are some race conditions that make it difficult to do this
correctly:

http://archives.postgresql.org/pgsql-jdbc/2003-11/msg00148.php
http://archives.postgresql.org/pgsql-jdbc/2003-09/msg00175.php

Kris Jurka

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: ps.setCharacterStream() and memory usage
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: PGobject overhaul (was Re: tightening up on use of oid