mirror of https://github.com/apache/lucene.git
LUCENE-3428: force DWPT unlock if unchecked exception is thrown by DWFC#addFlushableState
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1169877 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ef17a6766d
commit
0b55ddeedf
|
@ -366,15 +366,23 @@ public final class DocumentsWriterFlushControl {
|
||||||
ThreadState obtainAndLock() {
|
ThreadState obtainAndLock() {
|
||||||
final ThreadState perThread = perThreadPool.getAndLock(Thread
|
final ThreadState perThread = perThreadPool.getAndLock(Thread
|
||||||
.currentThread(), documentsWriter);
|
.currentThread(), documentsWriter);
|
||||||
if (perThread.isActive()
|
boolean success = false;
|
||||||
&& perThread.perThread.deleteQueue != documentsWriter.deleteQueue) {
|
try {
|
||||||
// There is a flush-all in process and this DWPT is
|
if (perThread.isActive()
|
||||||
// now stale -- enroll it for flush and try for
|
&& perThread.perThread.deleteQueue != documentsWriter.deleteQueue) {
|
||||||
// another DWPT:
|
// There is a flush-all in process and this DWPT is
|
||||||
addFlushableState(perThread);
|
// now stale -- enroll it for flush and try for
|
||||||
|
// another DWPT:
|
||||||
|
addFlushableState(perThread);
|
||||||
|
}
|
||||||
|
success = true;
|
||||||
|
// simply return the ThreadState even in a flush all case sine we already hold the lock
|
||||||
|
return perThread;
|
||||||
|
} finally {
|
||||||
|
if (!success) { // make sure we unlock if this fails
|
||||||
|
perThread.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// simply return the ThreadState even in a flush all case sine we already hold the lock
|
|
||||||
return perThread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void markForFullFlush() {
|
void markForFullFlush() {
|
||||||
|
|
Loading…
Reference in New Issue