mirror of https://github.com/apache/lucene.git
LUCENE-9084: fix potential deadlock due to circular synchronization in AnalyzingInfixSuggester
This commit is contained in:
parent
08b64aab8f
commit
deba7d1404
|
@ -120,7 +120,8 @@ Optimizations
|
|||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
(No changes)
|
||||
|
||||
* LUCENE-9084: Fix potential deadlock due to circular synchronization in AnalyzingInfixSuggester (Paul Ward)
|
||||
|
||||
Other
|
||||
---------------------
|
||||
|
|
|
@ -368,15 +368,16 @@ public class AnalyzingInfixSuggester extends Lookup implements Closeable {
|
|||
};
|
||||
}
|
||||
|
||||
private synchronized void ensureOpen() throws IOException {
|
||||
if (writer == null) {
|
||||
if (DirectoryReader.indexExists(dir)) {
|
||||
// Already built; open it:
|
||||
writer = new IndexWriter(dir, getIndexWriterConfig(getGramAnalyzer(), IndexWriterConfig.OpenMode.APPEND));
|
||||
} else {
|
||||
writer = new IndexWriter(dir, getIndexWriterConfig(getGramAnalyzer(), IndexWriterConfig.OpenMode.CREATE));
|
||||
}
|
||||
synchronized (searcherMgrLock) {
|
||||
private void ensureOpen() throws IOException {
|
||||
synchronized (searcherMgrLock) {
|
||||
if (writer == null) {
|
||||
if (DirectoryReader.indexExists(dir)) {
|
||||
// Already built; open it:
|
||||
writer = new IndexWriter(dir, getIndexWriterConfig(getGramAnalyzer(), IndexWriterConfig.OpenMode.APPEND));
|
||||
} else {
|
||||
writer = new IndexWriter(dir, getIndexWriterConfig(getGramAnalyzer(), IndexWriterConfig.OpenMode.CREATE));
|
||||
}
|
||||
|
||||
SearcherManager oldSearcherMgr = searcherMgr;
|
||||
searcherMgr = new SearcherManager(writer, null);
|
||||
if (oldSearcherMgr != null) {
|
||||
|
|
Loading…
Reference in New Issue