Package org.apache.lucene.index
Class DocumentsWriterStallControl
- java.lang.Object
-
- org.apache.lucene.index.DocumentsWriterStallControl
-
final class DocumentsWriterStallControl extends java.lang.ObjectControls the health status of aDocumentsWritersessions. This class used to block incoming indexing threads if flushing significantly slower than indexing to ensure theDocumentsWriters healthiness. If flushing is significantly slower than indexing the net memory used within anIndexWritersession can increase very quickly and easily exceed the JVM's available memory.To prevent OOM Errors and ensure IndexWriter's stability this class blocks incoming threads from indexing once 2 x number of available
DocumentsWriterPerThreads inDocumentsWriterPerThreadPoolis exceeded. Once flushing catches up and the number of flushing DWPT is equal or lower than the number of activeDocumentsWriterPerThreads threads are released and can continue indexing.
-
-
Field Summary
Fields Modifier and Type Field Description private intnumWaitingprivate booleanstalledprivate java.util.Map<java.lang.Thread,java.lang.Boolean>waitingprivate booleanwasStalled
-
Constructor Summary
Constructors Constructor Description DocumentsWriterStallControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleananyStalledThreads()private voiddecrWaiters()(package private) intgetNumWaiting()(package private) booleanhasBlocked()private voidincWaiters()(package private) booleanisHealthy()(package private) booleanisThreadQueued(java.lang.Thread t)(package private) voidupdateStalled(boolean stalled)Update the stalled flag status.(package private) voidwaitIfStalled()Blocks if documents writing is currently in a stalled state.(package private) booleanwasStalled()
-
-
-
Method Detail
-
updateStalled
void updateStalled(boolean stalled)
Update the stalled flag status. This method will set the stalled flag totrueiff the number of flushingDocumentsWriterPerThreadis greater than the number of activeDocumentsWriterPerThread. Otherwise it will reset theDocumentsWriterStallControlto healthy and release all threads waiting onwaitIfStalled()
-
waitIfStalled
void waitIfStalled()
Blocks if documents writing is currently in a stalled state.
-
anyStalledThreads
boolean anyStalledThreads()
-
incWaiters
private void incWaiters()
-
decrWaiters
private void decrWaiters()
-
hasBlocked
boolean hasBlocked()
-
getNumWaiting
int getNumWaiting()
-
isHealthy
boolean isHealthy()
-
isThreadQueued
boolean isThreadQueued(java.lang.Thread t)
-
wasStalled
boolean wasStalled()
-
-