You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Kay Kay (JIRA)" <ji...@apache.org> on 2008/12/16 22:58:44 UTC

[jira] Created: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Solr: Making finalizers call super.finalize() wrapped in try..finally block 
----------------------------------------------------------------------------

                 Key: SOLR-924
                 URL: https://issues.apache.org/jira/browse/SOLR-924
             Project: Solr
          Issue Type: Improvement
         Environment: Tomcat 6, JRE 6
            Reporter: Kay Kay


There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kay Kay updated SOLR-924:
-------------------------

    Fix Version/s: 1.4
         Priority: Minor  (was: Major)

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kay Kay closed SOLR-924.
------------------------


Thanks HossMan for committing the same. 

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Assignee: Hoss Man
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657421#action_12657421 ] 

Kay Kay commented on SOLR-924:
------------------------------

Not all of them seems to inherit from Object ( JdbcDataSource inherits from DataSource<?> ).  SolrIndexWriter from IndexWriter  etc.  So - to ensure proper cleanup of resources - we need to be having the try .. finally block around finalizers. 


> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kay Kay updated SOLR-924:
-------------------------

    Attachment: SOLR-924.patch

The following classes have their try .. finally clause implemented in finalizers set up for recursive call. 

Index: contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
Index: src/java/org/apache/solr/update/SolrIndexWriter.java
Index: src/java/org/apache/solr/core/SolrCore.java
Index: src/java/org/apache/solr/core/CoreContainer.java
Index: src/common/org/apache/solr/common/util/ConcurrentLRUCache.java


> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657702#action_12657702 ] 

Hoss Man commented on SOLR-924:
-------------------------------

What Kay is suggesting is a pretty well established "best practice" .. even if you *know* the super class has an empty finalize method it's still a good idea to call super.finalize() in a finally block because you have no garuntee someone else won't modify the implementation of the super class in a future version.  even when you subclass Object, super.finalize() is a good idea to protect yourself against yourself: future refactoring could inject a new super class (which could then gain a non-trivial finalize method)

i really see no downside to the patch

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657675#action_12657675 ] 

Kay Kay commented on SOLR-924:
------------------------------

| DataSource<?> is just an interface defined as an abstract class. For others it may be worth it. 

I believe we might as well be consistent when making changes instead of excluding based on specific super class implementation. 

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657293#action_12657293 ] 

Noble Paul commented on SOLR-924:
---------------------------------

Why do we need to call a super.finalize() when the super class is java.lang.Object ?

It achieves no purpose





> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man resolved SOLR-924.
---------------------------

    Resolution: Fixed
      Assignee: Hoss Man

Committed revision 728336.

thanks Kay.

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Assignee: Hoss Man
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kay Kay updated SOLR-924:
-------------------------

    Component/s: replication (java)
                 contrib - DataImportHandler

> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-924) Solr: Making finalizers call super.finalize() wrapped in try..finally block

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657669#action_12657669 ] 

Noble Paul commented on SOLR-924:
---------------------------------

DataSource<?> is just an interface defined as an abstract class. For others it may be worth it.

We do not have to be religious about this. if the superclass is doing something in the finalize then it is worth adding this or else we can drop it


> Solr: Making finalizers call super.finalize() wrapped in try..finally block 
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-924
>                 URL: https://issues.apache.org/jira/browse/SOLR-924
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler, replication (java)
>         Environment: Tomcat 6, JRE 6
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-924.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> There are some occurences of finalizers in the code base. While the presence of them is debatable and discussed in a separate JIRA - the ones that are retained are better off wrapped around a try .. finally block to recursively call the finalizer of the super class for proper resource usage unwinding , (in case finalizers get invoked ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.