Class OzoneManagerDoubleBuffer

java.lang.Object
org.apache.hadoop.ozone.om.ratis.OzoneManagerDoubleBuffer

public final class OzoneManagerDoubleBuffer extends Object
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.
  • Method Details

    • newBuilder

      public static OzoneManagerDoubleBuffer.Builder newBuilder()
    • start

      public OzoneManagerDoubleBuffer start()
    • acquireUnFlushedTransactions

      public void acquireUnFlushedTransactions(int n) throws InterruptedException
      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

      public void add(OMClientResponse response, org.apache.ratis.server.protocol.TermIndex termIndex)
      Add OmResponseBufferEntry to buffer.
    • resume

      public void resume()
    • awaitFlush

      public void awaitFlush() throws InterruptedException
      Throws:
      InterruptedException