LUCENE-9453 Assert lock held before volatile write (#1734)

Found via IntelliJ warnings.
This commit is contained in:
Mike Drob 2020-08-11 10:41:57 -05:00 committed by GitHub
parent 5887032e95
commit 092076ec39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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) {
assert Thread.holdsLock(this);
assert perThreadPool.isRegistered(perThread);
assert perThread.isHeldByCurrentThread();
assert perThread.isFlushPending() : "can not block non-pending threadstate";
assert fullFlush : "can not block if fullFlush == false";
numPending--;
numPending--; // write access synced
blockedFlushes.add(perThread);
boolean checkedOut = perThreadPool.checkout(perThread);
assert checkedOut;