Re: Remove usage of finalizers ? - Mailing list pgsql-jdbc

From Tom Dunstan
Subject Re: Remove usage of finalizers ?
Date
Msg-id CAPPfruy-NxMkfYARhEHkFY2NhFOVjKnZP2GQqVL6WXbf-h1ZYA@mail.gmail.com
Whole thread Raw
In response to Re: Remove usage of finalizers ?  (Vitalii Tymchyshyn <vit@tym.im>)
List pgsql-jdbc
On 23 October 2013 12:29, Vitalii Tymchyshyn <vit@tym.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


pgsql-jdbc by date:

Previous
From: Vitalii Tymchyshyn
Date:
Subject: Re: Remove usage of finalizers ?
Next
From: "Heiko W. Rupp"
Date:
Subject: Re: Remove usage of finalizers ?