Package org.apache.hadoop.ozone.om.ratis
Class OzoneManagerDoubleBuffer
java.lang.Object
org.apache.hadoop.ozone.om.ratis.OzoneManagerDoubleBuffer
This class implements DoubleBuffer implementation of OMClientResponse's. In
DoubleBuffer it has 2 buffers one is currentBuffer and other is
readyBuffer. The current OM requests will always be added to currentBuffer.
Flush thread will be running in background, it checks if currentBuffer has
any entries, it swaps the buffer and creates a batch and commit to DB.
Adding OM request to doubleBuffer and swap of buffer are synchronized
methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for creating OzoneManagerDoubleBuffer. -
Method Summary
Modifier and TypeMethodDescriptionvoidacquireUnFlushedTransactions(int n) Acquires the given number of permits from unFlushedTransactions, blocking until all are available, or the thread is interrupted.voidadd(OMClientResponse response, org.apache.ratis.server.protocol.TermIndex termIndex) Add OmResponseBufferEntry to buffer.voidvoidRuns in a background thread and batches the transaction in currentBuffer and commit to DB.voidresume()start()voidstop()Stop OM DoubleBuffer flush thread.void
-
Method Details
-
newBuilder
-
start
-
acquireUnFlushedTransactions
Acquires the given number of permits from unFlushedTransactions, blocking until all are available, or the thread is interrupted.- Throws:
InterruptedException
-
flushTransactions
public void flushTransactions()Runs in a background thread and batches the transaction in currentBuffer and commit to DB. -
stop
public void stop()Stop OM DoubleBuffer flush thread. -
stopDaemon
public void stopDaemon() -
add
Add OmResponseBufferEntry to buffer. -
resume
public void resume() -
awaitFlush
- Throws:
InterruptedException
-