Re: Remove usage of finalizers ?

Поиск
Список
Период
Сортировка
От David Wall
Тема Re: Remove usage of finalizers ?
Дата
Msg-id 52672420.6090109@computer.org
обсуждение исходный текст
Ответ на Re: Remove usage of finalizers ?  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
I agree that this is not a server side leak.  Anybody doing JDBC programming should know to do this, typically using a 'try-catch-finally', with the finally handling the cleanup of the Connection and Statement.  As I understand it, if you close a Statement, it will also close any ResultSets that you may have acquired from it so you don't have to close the ResultSet specifically. 


On 10/22/2013 6:03 PM, Dave Cramer wrote:
That's rather harsh. How do you see this as introducing a server side leak ? Statements are supposed to be closed by applications as are connections.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Tue, Oct 22, 2013 at 8:36 PM, Vitalii Tymchyshyn <vit@tym.im> wrote:

As for me, introducing server-side leak would be plain wrong. If it will be done, please announce in the list, I will stop recommending using postgresql in java projects.

23 жовт. 2013 03:12, користувач "Tom Dunstan" <pgsql@tomd.cc> написав:

On 21 October 2013 23:03, Dave Cramer <pg@fastcrypt.com> wrote:
> Please send patches for possible solutions. I think I would be OK with
> removing them and letting people find their Statement leaks

One option if we want to keep the existing behaviour available in some
way would be to remove the finalize method from AbstractJdbc2Statement
and create subclasses of the various concrete statement classes which
could be used when a debug flag is switched on. e.g.
DebugJdbc3Statement, DebugJdbc3PreparedStatement,
DebugJdbc3CallableStatement etc which have the finalizer present.

There would be quite a few of them though, and we'd need to have a
switch everywhere that one of those is instantiated, or introduce a
factory. It's a bit gross.

IMO tracing non-closed statement leaks is probably better done in a
connection pool or jdbc debugging library anyway, so maybe we
shouldn't bother and just remove it.

One question is this, though: how many users out there aren't closing
their statements currently and are relying, accidentally or
deliberately, on the current behaviour?

Tom


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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Remove usage of finalizers ?
Следующее
От: Tom Dunstan
Дата:
Сообщение: Re: Remove usage of finalizers ?