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 b1d2d44c0f7c..bbcfba6b5982 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -193,10 +193,7 @@ public CoreLoadFailure(CoreDescriptor cd, Exception loadFailure) { private volatile UpdateShardHandler updateShardHandler; - private final static ThreadPoolExecutor solrCoreLoadExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE, - 3, TimeUnit.SECONDS, - new SynchronousQueue<>(), - new SolrNamedThreadFactory("SolrCoreLoader")); + private volatile static ThreadPoolExecutor solrCoreLoadExecutor; private final OrderedExecutor replayUpdatesExecutor; @@ -387,12 +384,24 @@ public CoreContainer(SolrZkClient zkClient, NodeConfig config, CoresLocator loca work.addCollect("init"); } - if (zkClient != null) { - zkSys.initZooKeeper(this, cfg.getCloudConfig()); + if (zkClient != null) { + zkSys.initZooKeeper(this, cfg.getCloudConfig()); + } + coreConfigService = ConfigSetService.createConfigSetService(cfg, loader, zkSys == null ? null : zkSys.zkController); + + containerProperties.putAll(cfg.getSolrProperties()); + + if (solrCoreLoadExecutor == null) { + synchronized (CoreContainer.class) { + if (solrCoreLoadExecutor == null) { + solrCoreLoadExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE, + 3, TimeUnit.SECONDS, + new SynchronousQueue<>(), + new SolrNamedThreadFactory("SolrCoreLoader")); } - coreConfigService = ConfigSetService.createConfigSetService(cfg, loader, zkSys == null ? null : zkSys.zkController); + } + } - containerProperties.putAll(cfg.getSolrProperties()); } @SuppressWarnings({"unchecked"}) diff --git a/solr/core/src/test/org/apache/solr/schema/CustomAnalyzerStrField.java b/solr/core/src/test/org/apache/solr/schema/CustomAnalyzerStrField.java index e837e5d2af6c..2d2b28904232 100644 --- a/solr/core/src/test/org/apache/solr/schema/CustomAnalyzerStrField.java +++ b/solr/core/src/test/org/apache/solr/schema/CustomAnalyzerStrField.java @@ -39,7 +39,7 @@ public class CustomAnalyzerStrField extends StrField { private final Analyzer queryAnalyzer; public CustomAnalyzerStrField() { - Random r = LuceneTestCase.random(); + Random r = new Random(); // two arg constructor Analyzer a2 = new TokenizerChain