commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1094856 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Date Tue, 19 Apr 2011 15:13:31 GMT
On 19 April 2011 16:00, Torsten Curdt <tcurdt@vafer.org> wrote:
> I am really not comfortable doing all this stuff in finalize. Why use
> finalize at all?
> If someone forgot a close then he has to find and fix this in his code.
>
> Darn. Cannot find the reference I am thinking of why using "finalize"
> usually is really a bad idea. Was it from Bloch? Can't remember.

Bloch does say that generally finalizers should not be used..

However, he does say that they can be useful for "safety nets" in case
the object owner forgets to terminate it.
Better late than never.
In which case he says the finalizer should log a warning if the
resource has not been correctly terminated.

This is exactly what we are doing here.

> cheers,
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message