Re: Avoiding Statement.cancel() races

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Avoiding Statement.cancel() races
Дата
Msg-id Pine.LNX.4.33.0311210615030.32612-100000@leary.csoft.net
обсуждение исходный текст
Ответ на Avoiding Statement.cancel() races  (Oliver Jowett <oliver@opencloud.com>)
Ответы Re: Avoiding Statement.cancel() races
Список pgsql-jdbc

On Fri, 21 Nov 2003, Oliver Jowett wrote:

> However there's an obvious race condition here between starting query
> execution and cancelling the statement -- it's possible for
> stopWorkerThread() to run at just the wrong time and "cancel" the statement
> before it starts execution, having no effect and leaving the worker thread
> still running a query (at least as I understand cancel() .. that's how it's
> implemented in the postgresql driver anyway).

What if calling cancel on a non running statement threw an SQLException?
Then your stopWorkerThread could retry the cancel.

Kris Jurka


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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Avoiding Statement.cancel() races
Следующее
От: "guan zhifan"
Дата:
Сообщение: forhelp