diff --git a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java index e3df50555a3..5684bf42b0f 100644 --- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java +++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java @@ -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;