Eric Isakson wrote:
These all look appropriate to me. These finalizers protect against a program consuming system resources if a programmer forgets to call close and the object gets garbage collected. This is similar to the handling by java.io.FileInputStream and java.io.FileOutputStream see:

http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.html#finalize()

I never noticed that. Thanks for pointing it out! The presence of this probably makes Lucene's finalize() methods redundant, doesn't it?


In a perfect world, these wouldn't be needed and people would always call close before the objects become unreachable.

Having to call close() is like malloc/free or new/delete in C and C++, i.e., in an ideal world we shouldn't have to call them. It's only required here because the OS isn't integrated with Java's GC. But finalize() provides the hook to perform this integration.


Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to