Re: Remove usage of finalizers ?

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Vitalii Tymchyshyn <vit(at)tym(dot)im>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, PG-JDBC Mailing List <pgsql-jdbc(at)postgresql(dot)org>, "Heiko W(dot) Rupp" <hwr(at)pilhuhn(dot)de>
Subject: Re: Remove usage of finalizers ?
Date: 2013-10-23 04:07:33
Message-ID: CAPPfruy-NxMkfYARhEHkFY2NhFOVjKnZP2GQqVL6WXbf-h1ZYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 23 October 2013 12:29, Vitalii Tymchyshyn <vit(at)tym(dot)im> wrote:
> According to jdbc javadoc Statement.close simply releases resources without
> waiting for them to be closed automatically.

Interestingly, as recently as JDK 1.5 the javadoc for Statement said:
> Note: A Statement object is automatically closed when it is garbage
collected.
( http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/Statement.html#close() )

That language seems to have been removed as of JDK 1.6, presumably
because relying on finalizers for cleanup of any real resource hasn't
been considered good practice since well before even then. And that
was in 2006.

I'm a little bit frightened now that there may be code out there
relying on this behaviour, bad practice though it may be. Once again
I'd like to know if this case makes any difference or not, given our
other use of PhantomReferences etc.

Tom

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Heiko W. Rupp 2013-10-23 05:58:57 Re: Remove usage of finalizers ?
Previous Message Vitalii Tymchyshyn 2013-10-23 01:59:47 Re: Remove usage of finalizers ?