SOLR-924: Code cleanup: make all existing finalize() methods call super.finalize() in a finally block

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@728336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2008-12-20 20:03:30 +00:00
parent fc3eed423b
commit c7b3ca5d16
6 changed files with 30 additions and 10 deletions

View File

@ -223,6 +223,10 @@ Other Changes
10. SOLR-900: Moved solrj into /src/solrj. The contents of solr-common.jar is now included
in the solr-solrj.jar. (ryan)
11. SOLR-924: Code cleanup: make all existing finalize() methods call
super.finalize() in a finally block. All current instances extend
Object, so this doesn't fix any bugs, but helps protect against
future changes. (Kay Kay via hossman)
Build
----------------------

View File

@ -335,10 +335,11 @@ public class JdbcDataSource extends
}
}
protected void finalize() {
protected void finalize() throws Throwable {
try {
conn.close();
} catch (Exception e) {
} finally {
super.finalize();
}
}

View File

@ -530,6 +530,10 @@ public class ConcurrentLRUCache<K,V> {
}
protected void finalize() throws Throwable {
destroy();
try {
destroy();
} finally {
super.finalize();
}
}
}

View File

@ -261,8 +261,12 @@ public class CoreContainer
}
@Override
protected void finalize() {
shutdown();
protected void finalize() throws Throwable {
try {
shutdown();
} finally {
super.finalize();
}
}
/**

View File

@ -741,9 +741,14 @@ public final class SolrCore implements SolrInfoMBean {
return refCount.get() <= 0;
}
protected void finalize() {
if (getOpenCount() != 0) {
log.error("REFCOUNT ERROR: unreferenced " + this + " (" + getName() + ") has a reference count of " + getOpenCount());
protected void finalize() throws Throwable {
try {
if (getOpenCount() != 0) {
log.error("REFCOUNT ERROR: unreferenced " + this + " (" + getName()
+ ") has a reference count of " + getOpenCount());
}
} finally {
super.finalize();
}
}

View File

@ -198,11 +198,13 @@ public class SolrIndexWriter extends IndexWriter {
}
@Override
protected void finalize() {
protected void finalize() throws Throwable {
try {
super.close();
} catch (IOException e) {
} finally {
super.finalize();
}
}
}