Removed unnecessary finalize implementation.

On such private classes with limited scope but with frequent instance
creations and removals within the application lifecycle, implementing
the finalize method is particularly unwanted as it decreases the garbage
collector performance.
What's more the Object.finalize() method is now deprecated in the JDK 9
and will eventually disappear from future releases (see
https://bugs.openjdk.java.net/browse/JDK-8177970)
pull/122/head
luccioman 8 years ago
parent 632354e2ff
commit 4e4dc6c4e5

@ -377,7 +377,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
}
private class DocListSearcher {
private class DocListSearcher implements AutoCloseable {
private SolrQueryRequest request;
private DocList response;
@ -393,15 +393,13 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
if (resultContext == null) log.warn("DocListSearcher: no response for query '" + querystring + "'");
this.response = resultContext == null ? new DocSlice(0, 0, new int[0], new float[0], 0, 0.0f) : resultContext.docs;
}
@Override
public void close() {
if (this.request != null) this.request.close();
this.request = null;
this.response = null;
}
@Override
protected void finalize() throws Throwable {
try {close();} finally {super.finalize();}
}
}
@Override

Loading…
Cancel
Save