lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Hough (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-129) Finalizers are non-canonical
Date Wed, 16 Nov 2005 14:06:29 GMT
    [ http://issues.apache.org/jira/browse/LUCENE-129?page=comments#action_12357780 ] 

Sam Hough commented on LUCENE-129:
----------------------------------

Doh. Sorry. Been a long day. Finalize wont be called if DIRECTORIES still points at it :(
Think twice, post once.

Does this mean that clients of FSDirectory should have finalize methods that close the Directory?
IndexReader.finalize for instance just cleans up its lock but doesn't call close()!?

It is making my head hurt thinking back to C++ days of no automatic garbage collection.

Sorry.

> Finalizers are non-canonical
> ----------------------------
>
>          Key: LUCENE-129
>          URL: http://issues.apache.org/jira/browse/LUCENE-129
>      Project: Lucene - Java
>         Type: Bug
>   Components: Other
>     Versions: unspecified
>  Environment: Operating System: other
> Platform: All
>     Reporter: Esmond Pitt
>     Assignee: Lucene Developers
>     Priority: Minor

>
> The canonical form of a Java finalizer is:
> protected void finalize() throws Throwable()
> {
>  try
>  {
>    // ... local code to finalize this class
>  }
>  catch (Throwable t)
>  {
>  }
>  super.finalize(); // finalize base class.
> }
> The finalizers in IndexReader, IndexWriter, and FSDirectory don't conform. This
> is probably minor or null in effect, but the principle is important.
> As a matter of fact FSDirectory.finaliz() is entirely redundant and could be
> removed, as it doesn't do anything that RandomAccessFile.finalize would do
> automatically.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


Mime
View raw message