You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/29 01:21:09 UTC

[lucene-solr] 01/02: @440 Track lifecycle.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 20be06fc867565599b153026f09d050f958909cc
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 28 20:18:38 2020 -0500

    @440 Track lifecycle.
---
 .../src/java/org/apache/solr/update/SolrCmdDistributor.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index 9c16c1d..32bbe78 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -42,6 +42,7 @@ import org.apache.solr.common.cloud.ZkCoreNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.core.Diagnostics;
 import org.apache.solr.update.processor.DistributedUpdateProcessor;
 import org.apache.solr.update.processor.DistributedUpdateProcessor.LeaderRequestReplicationTracker;
@@ -66,7 +67,7 @@ public class SolrCmdDistributor implements Closeable {
     public boolean abortCheck();
   }
   
-  private Http2SolrClient solrClient;
+  private final Http2SolrClient solrClient;
 
   private final Phaser phaser = new Phaser(1) {
     @Override
@@ -76,14 +77,10 @@ public class SolrCmdDistributor implements Closeable {
   };
 
   public SolrCmdDistributor(UpdateShardHandler updateShardHandler) {
+    assert ObjectReleaseTracker.track(this);
     this.solrClient = new Http2SolrClient.Builder().markInternalRequest().withHttpClient(updateShardHandler.getUpdateOnlyHttpClient()).build();
   }
-  
-  /* For tests only */
-  SolrCmdDistributor(int maxRetriesOnForward) {
-    this.maxRetriesOnForward = maxRetriesOnForward;
-  }
-  
+
   public void finish() {
     assert !finished : "lifecycle sanity check";
     finished = true;
@@ -91,6 +88,7 @@ public class SolrCmdDistributor implements Closeable {
   
   public void close() {
     ParWork.close(solrClient);
+    assert ObjectReleaseTracker.release(this);
   }
 
   public boolean checkRetry(Error err) {