Package org.apache.bookkeeper.proto
Class PacketProcessorBase<T extends BookieProtocol.Request>
- java.lang.Object
-
- org.apache.bookkeeper.proto.PacketProcessorBase<T>
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ReadEntryProcessor,WriteEntryProcessor
abstract class PacketProcessorBase<T extends BookieProtocol.Request> extends java.lang.Object implements java.lang.RunnableA base class for bookeeper packet processors.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) longenqueueNanos(package private) Trequest(package private) BookieRequestHandlerrequestHandler(package private) BookieRequestProcessorrequestProcessor
-
Constructor Summary
Constructors Constructor Description PacketProcessorBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidinit(T request, BookieRequestHandler requestHandler, BookieRequestProcessor requestProcessor)protected booleanisVersionCompatible()protected abstract voidprocessPacket()protected voidreset()voidrun()protected voidsendReadReqResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger, boolean throttle)protected voidsendResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger)protected voidsendResponseAndWait(int rc, java.lang.Object response, OpStatsLogger statsLogger)Write on the channel and wait until the write is completed.protected voidsendWriteReqResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger)
-
-
-
Field Detail
-
request
T extends BookieProtocol.Request request
-
requestHandler
BookieRequestHandler requestHandler
-
requestProcessor
BookieRequestProcessor requestProcessor
-
enqueueNanos
long enqueueNanos
-
-
Method Detail
-
init
protected void init(T request, BookieRequestHandler requestHandler, BookieRequestProcessor requestProcessor)
-
reset
protected void reset()
-
isVersionCompatible
protected boolean isVersionCompatible()
-
sendWriteReqResponse
protected void sendWriteReqResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger)
-
sendReadReqResponse
protected void sendReadReqResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger, boolean throttle)
-
sendResponse
protected void sendResponse(int rc, java.lang.Object response, OpStatsLogger statsLogger)
-
sendResponseAndWait
protected void sendResponseAndWait(int rc, java.lang.Object response, OpStatsLogger statsLogger)Write on the channel and wait until the write is completed.That will make the thread to get blocked until we're able to write everything on the TCP stack, providing auto-throttling and avoiding using too much memory when handling read-requests.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
processPacket
protected abstract void processPacket()
-
-