Package io.netty.channel
Class FixedRecvByteBufAllocator
java.lang.Object
io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator
io.netty.channel.FixedRecvByteBufAllocator
- All Implemented Interfaces:
MaxMessagesRecvByteBufAllocator
,RecvByteBufAllocator
The
RecvByteBufAllocator
that always yields the same buffer
size prediction. This predictor ignores the feed back from the I/O thread.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator
DefaultMaxMessagesRecvByteBufAllocator.MaxMessageHandle
Nested classes/interfaces inherited from interface io.netty.channel.RecvByteBufAllocator
RecvByteBufAllocator.DelegatingHandle, RecvByteBufAllocator.ExtendedHandle, RecvByteBufAllocator.Handle
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFixedRecvByteBufAllocator
(int bufferSize) Creates a new predictor that always returns the same prediction of the specified buffer size. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new handle.respectMaybeMoreData
(boolean respectMaybeMoreData) Determine if future instances ofRecvByteBufAllocator.newHandle()
will stop reading if we think there is no more data.Methods inherited from class io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator
maxMessagesPerRead, maxMessagesPerRead, respectMaybeMoreData
-
Field Details
-
bufferSize
private final int bufferSize
-
-
Constructor Details
-
FixedRecvByteBufAllocator
public FixedRecvByteBufAllocator(int bufferSize) Creates a new predictor that always returns the same prediction of the specified buffer size.
-
-
Method Details
-
newHandle
Description copied from interface:RecvByteBufAllocator
Creates a new handle. The handle provides the actual operations and keeps the internal information which is required for predicting an optimal buffer capacity. -
respectMaybeMoreData
Description copied from class:DefaultMaxMessagesRecvByteBufAllocator
Determine if future instances ofRecvByteBufAllocator.newHandle()
will stop reading if we think there is no more data.- Overrides:
respectMaybeMoreData
in classDefaultMaxMessagesRecvByteBufAllocator
- Parameters:
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 ourDefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead()
quantum and have to wait for the selector to notify us of more data.false
to keep reading (up toDefaultMaxMessagesRecvByteBufAllocator.maxMessagesPerRead()
) or until there is no data when we attempt to read.
- Returns:
this
.
-