Package org.apache.bookkeeper.proto
Class ReadEntryProcessorV3
- java.lang.Object
-
- org.apache.bookkeeper.proto.PacketProcessorBaseV3
-
- org.apache.bookkeeper.proto.ReadEntryProcessorV3
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
LongPollReadEntryProcessorV3
class ReadEntryProcessorV3 extends PacketProcessorBaseV3
-
-
Field Summary
Fields Modifier and Type Field Description protected longentryIdprotected com.google.common.base.StopwatchlastPhaseStartTimeprotected longledgerIdprotected BookkeeperProtocol.ReadRequestreadRequestprotected OpStatsLoggerreadStatsprotected OpStatsLoggerreqStats-
Fields inherited from class org.apache.bookkeeper.proto.PacketProcessorBaseV3
enqueueNanos, request, requestHandler, requestProcessor
-
-
Constructor Summary
Constructors Constructor Description ReadEntryProcessorV3(BookkeeperProtocol.Request request, BookieRequestHandler requestHandler, BookieRequestProcessor requestProcessor, java.util.concurrent.ExecutorService fenceThreadPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BookkeeperProtocol.ReadResponsebuildResponse(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, BookkeeperProtocol.StatusCode statusCode, com.google.common.base.Stopwatch startTimeSw)protected voidexecuteOp()protected java.lang.LonggetPreviousLAC()protected BookkeeperProtocol.ReadResponsegetReadResponse()protected voidhandleReadResultForFenceRead(io.netty.buffer.ByteBuf entryBody, BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, com.google.common.base.Stopwatch startTimeSw)Handle read result for fence read.protected BookkeeperProtocol.ReadResponsereadEntry(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, boolean readLACPiggyBack, com.google.common.base.Stopwatch startTimeSw)Read a specific entry.protected BookkeeperProtocol.ReadResponsereadEntry(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, com.google.common.base.Stopwatch startTimeSw)Read a specific entry.protected voidregisterEvent(boolean failed, OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)protected voidregisterFailedEvent(OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)protected voidregisterSuccessfulEvent(OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)voidrun()protected voidsendResponse(BookkeeperProtocol.ReadResponse readResponse)java.lang.StringtoString()this toString method filters out masterKey from the output.-
Methods inherited from class org.apache.bookkeeper.proto.PacketProcessorBaseV3
getHeader, isVersionCompatible, sendResponse
-
-
-
-
Field Detail
-
lastPhaseStartTime
protected com.google.common.base.Stopwatch lastPhaseStartTime
-
readRequest
protected final BookkeeperProtocol.ReadRequest readRequest
-
ledgerId
protected final long ledgerId
-
entryId
protected final long entryId
-
readStats
protected final OpStatsLogger readStats
-
reqStats
protected final OpStatsLogger reqStats
-
-
Constructor Detail
-
ReadEntryProcessorV3
public ReadEntryProcessorV3(BookkeeperProtocol.Request request, BookieRequestHandler requestHandler, BookieRequestProcessor requestProcessor, java.util.concurrent.ExecutorService fenceThreadPool)
-
-
Method Detail
-
getPreviousLAC
protected java.lang.Long getPreviousLAC()
-
handleReadResultForFenceRead
protected void handleReadResultForFenceRead(io.netty.buffer.ByteBuf entryBody, BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, com.google.common.base.Stopwatch startTimeSw)Handle read result for fence read.- Parameters:
entryBody- read resultreadResponseBuilder- read response builderentryId- entry idstartTimeSw- timer for the read request
-
readEntry
protected BookkeeperProtocol.ReadResponse readEntry(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, com.google.common.base.Stopwatch startTimeSw) throws java.io.IOException, BookieException
Read a specific entry.- Parameters:
readResponseBuilder- read response builder.entryId- entry to readstartTimeSw- stop watch to measure the read operation.- Returns:
- read response or null if it is a fence read operation.
- Throws:
java.io.IOExceptionBookieException
-
readEntry
protected BookkeeperProtocol.ReadResponse readEntry(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, long entryId, boolean readLACPiggyBack, com.google.common.base.Stopwatch startTimeSw) throws java.io.IOException, BookieException
Read a specific entry.- Parameters:
readResponseBuilder- read response builder.entryId- entry to readstartTimeSw- stop watch to measure the read operation.- Returns:
- read response or null if it is a fence read operation.
- Throws:
java.io.IOExceptionBookieException
-
getReadResponse
protected BookkeeperProtocol.ReadResponse getReadResponse()
-
run
public void run()
-
executeOp
protected void executeOp()
-
buildResponse
protected BookkeeperProtocol.ReadResponse buildResponse(BookkeeperProtocol.ReadResponse.Builder readResponseBuilder, BookkeeperProtocol.StatusCode statusCode, com.google.common.base.Stopwatch startTimeSw)
-
sendResponse
protected void sendResponse(BookkeeperProtocol.ReadResponse readResponse)
-
registerSuccessfulEvent
protected void registerSuccessfulEvent(OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)
-
registerFailedEvent
protected void registerFailedEvent(OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)
-
registerEvent
protected void registerEvent(boolean failed, OpStatsLogger statsLogger, com.google.common.base.Stopwatch startTime)
-
toString
public java.lang.String toString()
this toString method filters out masterKey from the output. masterKey contains the password of the ledger.- Overrides:
toStringin classPacketProcessorBaseV3
-
-