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 <ted.dunning@gmail.com> wrote:
> +1
>
> (with exclamation marks)
>
> On Fri, May 20, 2011 at 7:07 PM, Sean Owen <srowen@gmail.com> 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 <bimargulies@gmail.com
>> >wrote:
>>
>> > Welcome to the Java garbage collector. You never know when it will
>> > close a stream.
>>
>
--
Lance Norskog
goksron@gmail.com
|