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/26 16:07:03 UTC

[lucene-solr] branch reference_impl updated: @345 Let's be a bit more correct.

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 23ec34f  @345 Let's be a bit more correct.
23ec34f is described below

commit 23ec34f73bd183b703870322b4041efbfb23ef19
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Jul 26 11:06:46 2020 -0500

    @345 Let's be a bit more correct.
---
 solr/core/src/java/org/apache/solr/core/CoreContainer.java         | 3 +++
 .../core/src/java/org/apache/solr/update/DefaultSolrCoreState.java | 7 +++----
 2 files changed, 6 insertions(+), 4 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 3264cfc..9f2db98 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1379,6 +1379,9 @@ public class CoreContainer implements Closeable {
         log.info("Creating SolrCore '{}' using configuration from {}, trusted={}", dcore.getName(), coreConfig.getName(), dcore.isConfigSetTrusted());
       }
       try {
+        if (isShutDown) {
+          throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Solr has been shutdown.");
+        }
         core = new SolrCore(this, dcore, coreConfig);
       } catch (SolrException e) {
         core = processCoreCreateException(e, dcore, coreConfig);
diff --git a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
index ef8e8da..66ea455 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -130,10 +130,6 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
               "Indexing is temporarily disabled");
     }
 
-    if (core != null && core.getCoreContainer().isShutDown()) {
-      throw new AlreadyClosedException();
-    }
-
     boolean succeeded = false;
     iwLock.readLock().lock();
     try {
@@ -145,6 +141,9 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
           if (refCntWriter == null) return null;
         } else {
           if (indexWriter == null) {
+            if (core != null && core.getCoreContainer().isShutDown() || closed) {
+              throw new AlreadyClosedException();
+            }
             indexWriter = createMainIndexWriter(core, "DirectUpdateHandler2");
           }
           initRefCntWriter();