Package org.apache.bookkeeper.client
Class PendingReadOp
- java.lang.Object
-
- org.apache.bookkeeper.client.PendingReadOp
-
- All Implemented Interfaces:
java.lang.Runnable
,org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback
- Direct Known Subclasses:
ListenerBasedPendingReadOp
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
PendingReadOp.LedgerEntryRequest
(package private) class
PendingReadOp.ParallelReadRequest
(package private) class
PendingReadOp.SequenceReadRequest
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
allowFailFast
(package private) ClientContext
clientCtx
(package private) java.util.concurrent.atomic.AtomicBoolean
complete
(package private) long
endEntryId
(package private) boolean
isRecoveryRead
(package private) LedgerHandle
lh
(package private) long
numPendingEntries
(package private) boolean
parallelRead
(package private) long
requestTimeNanos
(package private) int
requiredBookiesMissingEntryForRecovery
protected java.util.LinkedList<PendingReadOp.LedgerEntryRequest>
seq
(package private) long
startEntryId
-
Constructor Summary
Constructors Constructor Description PendingReadOp(LedgerHandle lh, ClientContext clientCtx, long startEntryId, long endEntryId, boolean isRecoveryRead)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
allowFailFastOnUnwritableChannel()
protected void
cancelSpeculativeTask(boolean mayInterruptIfRunning)
(package private) java.util.concurrent.CompletableFuture<LedgerEntries>
future()
protected LedgerMetadata
getLedgerMetadata()
java.util.concurrent.ScheduledFuture<?>
getSpeculativeTask()
(package private) void
initiate()
(package private) PendingReadOp
parallelRead(boolean enabled)
void
readEntryComplete(int rc, long ledgerId, long entryId, io.netty.buffer.ByteBuf buffer, java.lang.Object ctx)
void
run()
(package private) void
sendReadTo(int bookieIndex, org.apache.bookkeeper.net.BookieId to, PendingReadOp.LedgerEntryRequest entry)
void
submit()
protected void
submitCallback(int code)
-
-
-
Field Detail
-
seq
protected final java.util.LinkedList<PendingReadOp.LedgerEntryRequest> seq
-
lh
LedgerHandle lh
-
clientCtx
final ClientContext clientCtx
-
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()
-
getLedgerMetadata
protected LedgerMetadata getLedgerMetadata()
-
cancelSpeculativeTask
protected void cancelSpeculativeTask(boolean mayInterruptIfRunning)
-
getSpeculativeTask
public java.util.concurrent.ScheduledFuture<?> getSpeculativeTask()
-
parallelRead
PendingReadOp parallelRead(boolean enabled)
-
allowFailFastOnUnwritableChannel
void allowFailFastOnUnwritableChannel()
-
submit
public void submit()
-
initiate
void initiate()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
sendReadTo
void sendReadTo(int bookieIndex, org.apache.bookkeeper.net.BookieId to, PendingReadOp.LedgerEntryRequest entry) throws java.lang.InterruptedException
- 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 interfaceorg.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback
-
submitCallback
protected void submitCallback(int code)
-
-