SOLR-4161: add a little more protection

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1420500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-12-12 00:38:14 +00:00
parent 50407282a7
commit 8472da6e82
1 changed files with 6 additions and 1 deletions

View File

@ -74,6 +74,11 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
@Override @Override
public synchronized RefCounted<IndexWriter> getIndexWriter(SolrCore core) public synchronized RefCounted<IndexWriter> getIndexWriter(SolrCore core)
throws IOException { throws IOException {
if (closed) {
throw new RuntimeException("SolrCoreState already closed");
}
synchronized (writerPauseLock) { synchronized (writerPauseLock) {
if (core == null) { if (core == null) {
// core == null is a signal to just return the current writer, or 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) {} } catch (InterruptedException e) {}
if (closed) { if (closed) {
throw new RuntimeException("Already closed"); throw new RuntimeException("SolrCoreState already closed");
} }
} }