Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-914

Presence of finalize() in the codebase

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Component/s: clients - java
    • Labels:
      None
    • Environment:

      Tomcat 6, JRE 6

      Description

      There seems to be a number of classes - that implement finalize() method. Given that it is perfectly ok for a Java VM to not to call it - may be - there has to some other way

      { try .. finally - when they are created to destroy them }

      to destroy them and the presence of finalize() method , ( depending on implementation ) might not serve what we want and in some cases can end up delaying the gc process, depending on the algorithms.

      $ find . -name *.java | xargs grep finalize
      ./contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java: protected void finalize() {
      ./src/java/org/apache/solr/update/SolrIndexWriter.java: protected void finalize() {
      ./src/java/org/apache/solr/core/CoreContainer.java: protected void finalize() {
      ./src/java/org/apache/solr/core/SolrCore.java: protected void finalize() {
      ./src/common/org/apache/solr/common/util/ConcurrentLRUCache.java: protected void finalize() throws Throwable {

      May be we need to revisit these occurences from a design perspective to see if they are necessary / if there is an alternate way of managing guaranteed destruction of resources.

        Attachments

        1. SOLR-914.patch
          4 kB
          Hoss Man
        2. SOLR-914.patch
          4 kB
          Noble Paul

          Issue Links

            Activity

              People

              • Assignee:
                hossman Hoss Man
                Reporter:
                kaykay.unique Karthik K
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 480h
                  480h
                  Remaining:
                  Remaining Estimate - 480h
                  480h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified