public class AdaptiveRecvByteBufAllocator extends DefaultMaxMessagesRecvByteBufAllocator
RecvByteBufAllocator
that automatically increases and
decreases the predicted buffer size on feed back.
It gradually increases the expected number of readable bytes if the previous read fully filled the allocated buffer. It gradually decreases the expected number of readable bytes if the read operation was not able to fill a certain amount of the allocated buffer two times consecutively. Otherwise, it keeps returning the same prediction.
DefaultMaxMessagesRecvByteBufAllocator.MaxMessageHandle
RecvByteBufAllocator.DelegatingHandle, RecvByteBufAllocator.ExtendedHandle, RecvByteBufAllocator.Handle
限定符和类型 | 字段和说明 |
---|---|
static AdaptiveRecvByteBufAllocator |
DEFAULT
已过时。
There is state for
DefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead() which is typically based upon channel type. |
构造器和说明 |
---|
AdaptiveRecvByteBufAllocator()
Creates a new predictor with the default parameters.
|
AdaptiveRecvByteBufAllocator(int minimum,
int initial,
int maximum)
Creates a new predictor with the specified parameters.
|
限定符和类型 | 方法和说明 |
---|---|
RecvByteBufAllocator.Handle |
newHandle()
Creates a new handle.
|
AdaptiveRecvByteBufAllocator |
respectMaybeMoreData(boolean respectMaybeMoreData)
Determine if future instances of
RecvByteBufAllocator.newHandle() will stop reading if we think there is no more data. |
maxMessagesPerRead, maxMessagesPerRead, respectMaybeMoreData
@Deprecated public static final AdaptiveRecvByteBufAllocator DEFAULT
DefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead()
which is typically based upon channel type.public AdaptiveRecvByteBufAllocator()
1024
, does not
go down below 64
, and does not go up above 65536
.public AdaptiveRecvByteBufAllocator(int minimum, int initial, int maximum)
minimum
- the inclusive lower bound of the expected buffer sizeinitial
- the initial buffer size when no feed back was receivedmaximum
- the inclusive upper bound of the expected buffer sizepublic RecvByteBufAllocator.Handle newHandle()
RecvByteBufAllocator
public AdaptiveRecvByteBufAllocator respectMaybeMoreData(boolean respectMaybeMoreData)
RecvByteBufAllocator.newHandle()
will stop reading if we think there is no more data.respectMaybeMoreData
在类中 DefaultMaxMessagesRecvByteBufAllocator
respectMaybeMoreData
- true
to stop reading if we think there is no more data. This may save a system call to read from
the socket, but if data has arrived in a racy fashion we may give up our DefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead()
quantum and have to wait for the selector to notify us of more data.false
to keep reading (up to DefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead()
) or until there is no data when we
attempt to read.this
.