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/09/18 19:16:03 UTC

[lucene-solr] branch reference_impl_dev updated: @857 Quick fix.

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new af06f3b  @857 Quick fix.
af06f3b is described below

commit af06f3b0d1c01ffbfe35951c2257d6960245b027
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Sep 18 14:15:46 2020 -0500

    @857 Quick fix.
---
 solr/core/src/java/org/apache/solr/core/SolrCore.java         |  2 +-
 .../client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java    |  2 --
 .../src/java/org/apache/solr/common/ParWorkExecutor.java      |  2 +-
 .../src/java/org/apache/solr/common/util/CloseTracker.java    | 11 ++++++++++-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index c7ee28d..65161e6 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1912,7 +1912,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
   private final LinkedList<RefCounted<SolrIndexSearcher>> _searchers = new LinkedList<>();
   private final LinkedList<RefCounted<SolrIndexSearcher>> _realtimeSearchers = new LinkedList<>();
 
-  final ExecutorService searcherExecutor = ParWork.getExecutorService(1, true, true);
+  final ExecutorService searcherExecutor = new ParWorkExecutor("searcherExecutor", 1, 1, 1, new ArrayBlockingQueue(6, true));
   private AtomicInteger onDeckSearchers = new AtomicInteger();  // number of searchers preparing
   // Lock ordering: one can acquire the openSearcherLock and then the searcherLock, but not vice-versa.
   private final Object searcherLock = new Object();  // the sync object for the searcher
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
index 8369b4b..233eb00 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
@@ -43,7 +43,6 @@ import org.apache.solr.common.params.QoSParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.params.UpdateParams;
 import org.apache.solr.common.util.ExecutorUtil;
-import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SolrNamedThreadFactory;
 import org.eclipse.jetty.client.api.Response;
@@ -316,7 +315,6 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
         // make sure the stream is full read
         is.skip(is.available());
         while (is.read() != -1) {}
-        IOUtils.closeQuietly(is);
       } catch (UnsupportedOperationException e) {
         // nothing to do then
       } catch (IOException e) {
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
index 7538dbd..818a708 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
@@ -51,7 +51,7 @@ public class ParWorkExecutor extends ThreadPoolExecutor {
       int keepalive, BlockingQueue<Runnable> workQueue) {
     super(corePoolsSize, maxPoolsSize, keepalive, TimeUnit.MILLISECONDS, workQueue
     , new ParWorkThreadFactory(name));
-    assert (closeTracker = new CloseTracker()) != null;
+    assert (closeTracker = new CloseTracker(false)) != null;
   }
 
   public void shutdown() {
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/CloseTracker.java b/solr/solrj/src/java/org/apache/solr/common/util/CloseTracker.java
index 8dba97a..a54b91b 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/CloseTracker.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/CloseTracker.java
@@ -10,18 +10,27 @@ public class CloseTracker {
 
     public static volatile AlreadyClosedException lastAlreadyClosedEx;
     public static volatile IllegalCallerException lastIllegalCallerEx;
+    private boolean checkClosedTwice;
 
     private volatile boolean closed = false;
     private volatile String closeStack = "";
     private volatile boolean closeLock;
 
+    public CloseTracker() {
+
+    }
+
+    public CloseTracker(boolean checkClosedTwice) {
+        this.checkClosedTwice = checkClosedTwice;
+    }
+
     public boolean close() {
         if (closeLock) {
             IllegalCallerException ex = new IllegalCallerException("Attempt to close an object that is not owned");
             lastIllegalCallerEx = ex;
             throw ex;
         }
-        if (closed) {
+        if (checkClosedTwice && closed) {
             StringBuilderWriter sw = new StringBuilderWriter(4096);
             PrintWriter pw = new PrintWriter(sw);
             new ObjectReleaseTracker.ObjectTrackerException(this.getClass().getName()).printStackTrace(pw);