Class PendingReadOp

  • All Implemented Interfaces:
    java.lang.Runnable, org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback
    Direct Known Subclasses:

    class PendingReadOp
    extends java.lang.Object
    implements org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback, java.lang.Runnable
    Sequence of entries of a ledger that represents a pending read operation. When all the data read has come back, the application callback is called. This class could be improved because we could start pushing data to the application as soon as it arrives rather than waiting for the whole thing.
    • Field Detail

      • numPendingEntries

        long numPendingEntries
      • startEntryId

        final long startEntryId
      • endEntryId

        final long endEntryId
      • requestTimeNanos

        long requestTimeNanos
      • requiredBookiesMissingEntryForRecovery

        final int requiredBookiesMissingEntryForRecovery
      • isRecoveryRead

        final boolean isRecoveryRead
      • parallelRead

        boolean parallelRead
      • complete

        final java.util.concurrent.atomic.AtomicBoolean complete
      • allowFailFast

        boolean allowFailFast
    • Constructor Detail

      • PendingReadOp

        PendingReadOp​(LedgerHandle lh,
                      ClientContext clientCtx,
                      long startEntryId,
                      long endEntryId,
                      boolean isRecoveryRead)
    • Method Detail

      • future

        java.util.concurrent.CompletableFuture<LedgerEntries> future()
      • cancelSpeculativeTask

        protected void cancelSpeculativeTask​(boolean mayInterruptIfRunning)
      • getSpeculativeTask

        public java.util.concurrent.ScheduledFuture<?> getSpeculativeTask()
      • allowFailFastOnUnwritableChannel

        void allowFailFastOnUnwritableChannel()
      • submit

        public void submit()
      • initiate

        void initiate()
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • sendReadTo

        void sendReadTo​(int bookieIndex,
                        PendingReadOp.LedgerEntryRequest entry)
                 throws java.lang.InterruptedException
      • readEntryComplete

        public void readEntryComplete​(int rc,
                                      long ledgerId,
                                      long entryId,
                                      io.netty.buffer.ByteBuf buffer,
                                      java.lang.Object ctx)
        Specified by:
        readEntryComplete in interface org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback
      • submitCallback

        protected void submitCallback​(int code)