Skip to content

Apache Lucene open-source search software

SOLR-3621: release writer get lock in a finally

Mark Robert Millerc33118ce897c
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 904e011b8e9..08e28c88a18 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -92,16 +92,18 @@ public final class DefaultSolrCoreState extends SolrCoreState {
wait();
} catch (InterruptedException e) {}
}
-
- if (indexWriter != null) {
- indexWriter.close();
+ try {
+ if (indexWriter != null) {
+ indexWriter.close();
+ }
+ indexWriter = createMainIndexWriter(core, "DirectUpdateHandler2", false,
+ true);
+ // we need to null this so it picks up the new writer next get call
+ refCntWriter = null;
+ } finally {
+ pauseWriter = false;
+ notifyAll();
}
- indexWriter = createMainIndexWriter(core, "DirectUpdateHandler2",
- false, true);
- // we need to null this so it picks up the new writer next get call
- refCntWriter = null;
- pauseWriter = false;
- notifyAll();
}
@Override