In Solr the practice is:

finalize() {
   if (! closed()) {
        log(WARN, "Hey! You didn't call close!");
        close();
    }
}

On Fri, May 20, 2011 at 7:09 PM, Ted Dunning <[email protected]> wrote:
> +1
>
> (with exclamation marks)
>
> On Fri, May 20, 2011 at 7:07 PM, Sean Owen <[email protected]> wrote:
>
>> (Yes there is no guarantee when a reclaimable object is finalize()-ed and
>> removed. But as an aside, I believe we all understand that relying on that
>> behavior is wrong? Letting finalize() close a stream is a bug for sure. If
>> we're suggesting that's the case here, that's bad. All streams ought to be
>> explicitly closed.)
>>
>> On Fri, May 20, 2011 at 11:07 PM, Benson Margulies <[email protected]
>> >wrote:
>>
>> > Welcome to the Java garbage collector. You never know when it will
>> > close a stream.
>>
>



-- 
Lance Norskog
[email protected]

Reply via email to