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/14 16:50:20 UTC

[lucene-solr] branch reference_impl updated: #147 - Give core loading back it's own exec.

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

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 5df8928  #147 - Give core loading back it's own exec.
5df8928 is described below

commit 5df89284ac1d46e60c34e05653c4ec99a63225ee
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 11:50:04 2020 -0500

    #147 - Give core loading back it's own exec.
---
 .../java/org/apache/solr/core/CoreContainer.java   | 23 ++++++++++++++++++++--
 .../org/apache/solr/SolrIgnoredThreadsFilter.java  |  4 ++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 2cd5736..9ae2ec5 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -42,6 +42,9 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
@@ -188,7 +191,23 @@ public class CoreContainer implements Closeable {
   protected volatile ZkContainer zkSys = null;
   protected volatile ShardHandlerFactory shardHandlerFactory;
 
-  protected volatile UpdateShardHandler updateShardHandler;
+  private volatile UpdateShardHandler updateShardHandler;
+
+  private final static ThreadPoolExecutor solrCoreLoadExecutor =  new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE,
+          3, TimeUnit.SECONDS,
+          new SynchronousQueue<>(),
+          new SolrNamedThreadFactory("SolrCoreLoader"));
+  static {
+    solrCoreLoadExecutor.setThreadFactory(new ThreadFactory() {
+      @Override
+      public Thread newThread(Runnable runnable) {
+        Thread t = new Thread(runnable);
+        t.setDaemon(true);
+        t.setName("SolrCoreLoader");
+        return t;
+      }
+    });
+  }
 
   private final OrderedExecutor replayUpdatesExecutor;
 
@@ -872,7 +891,7 @@ public class CoreContainer implements Closeable {
             }
             if (cd.isLoadOnStartup()) {
               ParWork.sizePoolByLoad();
-              futures.add(ParWork.getExecutor().submit(() -> {
+              futures.add(solrCoreLoadExecutor.submit(() -> {
                 SolrCore core;
                 try {
                   if (isZooKeeperAware()) {
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
index 6179c8b..ffc5d05 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
@@ -86,6 +86,10 @@ public class SolrIgnoredThreadsFilter implements ThreadFilter {
     if (threadName.startsWith("ConnnectionExpirer")) {
       return true;
     }
+    
+    if (threadName.startsWith("SolrCoreLoader")) {
+      return true;
+    }