Skip to content

Apache Lucene open-source search software

SOLR-4161: add a little more protection

Mark Robert Miller8472da6e8256
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 2a1e17fec90..e98ce048990 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -74,6 +74,11 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
@Override
public synchronized RefCounted<IndexWriter> getIndexWriter(SolrCore core)
throws IOException {
+
+ if (closed) {
+ throw new RuntimeException("SolrCoreState already closed");
+ }
+
synchronized (writerPauseLock) {
if (core == null) {
// core == null is a signal to just return the current writer, or null
@@ -136,7 +141,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
} catch (InterruptedException e) {}
if (closed) {
- throw new RuntimeException("Already closed");
+ throw new RuntimeException("SolrCoreState already closed");
}
}