Package org.apache.bookkeeper.proto
Class BookieRequestProcessor
- java.lang.Object
-
- org.apache.bookkeeper.proto.BookieRequestProcessor
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,RequestProcessor
public class BookieRequestProcessor extends java.lang.Object implements RequestProcessor
An implementation of the RequestProcessor interface.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.Semaphore
addsSemaphore
(package private) java.util.Optional<com.google.common.cache.Cache<io.netty.channel.Channel,java.lang.Boolean>>
blacklistedChannels
(package private) Bookie
bookie
This is the Bookie instance that is used to handle all read and write requests.(package private) java.util.function.Consumer<io.netty.channel.Channel>
onResponseTimeout
(package private) java.util.concurrent.Semaphore
readsSemaphore
-
Constructor Summary
Constructors Constructor Description BookieRequestProcessor(ServerConfiguration serverCfg, Bookie bookie, StatsLogger statsLogger, SecurityHandlerFactory shFactory, io.netty.buffer.ByteBufAllocator allocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
blacklistChannel(io.netty.channel.Channel channel)
void
close()
Close the request processor.(package private) java.util.concurrent.Semaphore
getAddsSemaphore()
(package private) io.netty.buffer.ByteBufAllocator
getAllocator()
(package private) BKStats
getBkStats()
(package private) java.util.Optional<com.google.common.cache.Cache<io.netty.channel.Channel,java.lang.Boolean>>
getBlacklistedChannels()
(package private) Bookie
getBookie()
This is the Bookie instance that is used to handle all read and write requests.(package private) OrderedExecutor
getHighPriorityThreadPool()
The threadpool used to execute high priority requests.(package private) OrderedExecutor
getLongPollThreadPool()
The threadpool used to execute all long poll requests issued to this server after they are done waiting.(package private) java.util.function.Consumer<io.netty.channel.Channel>
getOnResponseTimeout()
(package private) java.util.concurrent.Semaphore
getReadsSemaphore()
(package private) OrderedExecutor
getReadThreadPool()
The threadpool used to execute all read entry requests issued to this server.(package private) RequestStats
getRequestStats()
(package private) io.netty.util.HashedWheelTimer
getRequestTimer()
The Timer used to time out requests for long polling.(package private) ServerConfiguration
getServerCfg()
The server configuration.(package private) SecurityHandlerFactory
getShFactory()
TLS management.long
getWaitTimeoutOnBackpressureMillis()
(package private) OrderedExecutor
getWriteThreadPool()
The threadpool used to execute all add entry requests issued to this server.void
handleNonWritableChannel(io.netty.channel.Channel channel)
void
invalidateBlacklist(io.netty.channel.Channel channel)
boolean
isBlacklisted(io.netty.channel.Channel channel)
(package private) boolean
isPreserveMdcForTaskExecution()
(package private) boolean
isStatsEnabled()
(package private) boolean
isThrottleReadResponses()
(package private) int
maxAddsInProgressCount()
(package private) int
maxReadsInProgressCount()
protected void
onAddRequestFinish()
protected void
onAddRequestStart(io.netty.channel.Channel channel)
protected void
onReadRequestFinish()
protected void
onReadRequestStart(io.netty.channel.Channel channel)
void
processRequest(java.lang.Object msg, io.netty.channel.Channel c)
Process request.
-
-
-
Field Detail
-
bookie
final Bookie bookie
This is the Bookie instance that is used to handle all read and write requests.
-
addsSemaphore
final java.util.concurrent.Semaphore addsSemaphore
-
readsSemaphore
final java.util.concurrent.Semaphore readsSemaphore
-
blacklistedChannels
final java.util.Optional<com.google.common.cache.Cache<io.netty.channel.Channel,java.lang.Boolean>> blacklistedChannels
-
onResponseTimeout
final java.util.function.Consumer<io.netty.channel.Channel> onResponseTimeout
-
-
Constructor Detail
-
BookieRequestProcessor
public BookieRequestProcessor(ServerConfiguration serverCfg, Bookie bookie, StatsLogger statsLogger, SecurityHandlerFactory shFactory, io.netty.buffer.ByteBufAllocator allocator) throws SecurityException
- Throws:
SecurityException
-
-
Method Detail
-
onAddRequestStart
protected void onAddRequestStart(io.netty.channel.Channel channel)
-
onAddRequestFinish
protected void onAddRequestFinish()
-
onReadRequestStart
protected void onReadRequestStart(io.netty.channel.Channel channel)
-
onReadRequestFinish
protected void onReadRequestFinish()
-
maxAddsInProgressCount
int maxAddsInProgressCount()
-
maxReadsInProgressCount
int maxReadsInProgressCount()
-
close
public void close()
Description copied from interface:RequestProcessor
Close the request processor.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceRequestProcessor
-
processRequest
public void processRequest(java.lang.Object msg, io.netty.channel.Channel c)
Description copied from interface:RequestProcessor
Process request.- Specified by:
processRequest
in interfaceRequestProcessor
- Parameters:
msg
- request to processc
- channel received the given request r
-
getWaitTimeoutOnBackpressureMillis
public long getWaitTimeoutOnBackpressureMillis()
-
blacklistChannel
public void blacklistChannel(io.netty.channel.Channel channel)
-
invalidateBlacklist
public void invalidateBlacklist(io.netty.channel.Channel channel)
-
isBlacklisted
public boolean isBlacklisted(io.netty.channel.Channel channel)
-
handleNonWritableChannel
public void handleNonWritableChannel(io.netty.channel.Channel channel)
-
getServerCfg
ServerConfiguration getServerCfg()
The server configuration. We use this for getting the number of add and read worker threads.
-
isPreserveMdcForTaskExecution
boolean isPreserveMdcForTaskExecution()
-
getBookie
Bookie getBookie()
This is the Bookie instance that is used to handle all read and write requests.
-
getReadThreadPool
OrderedExecutor getReadThreadPool()
The threadpool used to execute all read entry requests issued to this server.
-
getWriteThreadPool
OrderedExecutor getWriteThreadPool()
The threadpool used to execute all add entry requests issued to this server.
-
getShFactory
SecurityHandlerFactory getShFactory()
TLS management.
-
getLongPollThreadPool
OrderedExecutor getLongPollThreadPool()
The threadpool used to execute all long poll requests issued to this server after they are done waiting.
-
getHighPriorityThreadPool
OrderedExecutor getHighPriorityThreadPool()
The threadpool used to execute high priority requests.
-
getRequestTimer
io.netty.util.HashedWheelTimer getRequestTimer()
The Timer used to time out requests for long polling.
-
getBkStats
BKStats getBkStats()
-
isStatsEnabled
boolean isStatsEnabled()
-
getRequestStats
RequestStats getRequestStats()
-
getAddsSemaphore
java.util.concurrent.Semaphore getAddsSemaphore()
-
getReadsSemaphore
java.util.concurrent.Semaphore getReadsSemaphore()
-
getBlacklistedChannels
java.util.Optional<com.google.common.cache.Cache<io.netty.channel.Channel,java.lang.Boolean>> getBlacklistedChannels()
-
getOnResponseTimeout
java.util.function.Consumer<io.netty.channel.Channel> getOnResponseTimeout()
-
getAllocator
io.netty.buffer.ByteBufAllocator getAllocator()
-
isThrottleReadResponses
boolean isThrottleReadResponses()
-
-