mirror of https://github.com/apache/lucene.git
LUCENE-9453 Assert lock held before volatile write (#1734)
Found via IntelliJ warnings.
This commit is contained in:
parent
5887032e95
commit
092076ec39
|
@ -324,12 +324,16 @@ final class DocumentsWriterFlushControl implements Accountable, Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To be called only by the owner of this object's monitor lock
|
||||||
|
*/
|
||||||
private void checkoutAndBlock(DocumentsWriterPerThread perThread) {
|
private void checkoutAndBlock(DocumentsWriterPerThread perThread) {
|
||||||
|
assert Thread.holdsLock(this);
|
||||||
assert perThreadPool.isRegistered(perThread);
|
assert perThreadPool.isRegistered(perThread);
|
||||||
assert perThread.isHeldByCurrentThread();
|
assert perThread.isHeldByCurrentThread();
|
||||||
assert perThread.isFlushPending() : "can not block non-pending threadstate";
|
assert perThread.isFlushPending() : "can not block non-pending threadstate";
|
||||||
assert fullFlush : "can not block if fullFlush == false";
|
assert fullFlush : "can not block if fullFlush == false";
|
||||||
numPending--;
|
numPending--; // write access synced
|
||||||
blockedFlushes.add(perThread);
|
blockedFlushes.add(perThread);
|
||||||
boolean checkedOut = perThreadPool.checkout(perThread);
|
boolean checkedOut = perThreadPool.checkout(perThread);
|
||||||
assert checkedOut;
|
assert checkedOut;
|
||||||
|
|
Loading…
Reference in New Issue