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.
| Modifier and Type | Class and Description |
|---|---|
| private class | AdaptiveRecvByteBufAllocator.
Deprecated
as a consequence of
DefaultMaxMessagesRecvByteBufAllocator.MaxMessageHandle being deprecated.
|
| Modifier and Type | Field and Description |
|---|---|
| public static final AdaptiveRecvByteBufAllocator | DEFAULT
Deprecated
There is state for
maxMessagesPerRead() which is typically based upon channel type.
|
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| private static final int | |
| private static final int | |
| private final int | |
| private final int | |
| private final int | |
| private static final int[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AdaptiveRecvByteBufAllocator(int
the inclusive lower bound of the expected buffer size minimum, int the initial buffer size when no feed back was received initial, int the inclusive upper bound of the expected buffer size maximum)Creates a new predictor with the specified parameters. |
| Modifier and Type | Method and Description |
|---|---|
| private static int | |
| public RecvByteBufAllocator. | newHandle()
Implements io.
Deprecated
as a consequence of
Creates a new handle.
RecvByteBufAllocator.Handle being deprecated.
|
| public AdaptiveRecvByteBufAllocator | respectMaybeMoreData(boolean
Overrides io. newHandle() will stop reading if we think there is no more data.
|
| DEFAULT | back to summary |
|---|---|
| public static final AdaptiveRecvByteBufAllocator DEFAULT
Deprecated There is state for | |
| DEFAULT_INITIAL | back to summary |
|---|---|
| pack-priv static final int DEFAULT_INITIAL | |
| DEFAULT_MAXIMUM | back to summary |
|---|---|
| pack-priv static final int DEFAULT_MAXIMUM | |
| DEFAULT_MINIMUM | back to summary |
|---|---|
| pack-priv static final int DEFAULT_MINIMUM | |
| INDEX_DECREMENT | back to summary |
|---|---|
| private static final int INDEX_DECREMENT | |
| INDEX_INCREMENT | back to summary |
|---|---|
| private static final int INDEX_INCREMENT | |
| initial | back to summary |
|---|---|
| private final int initial | |
| maxIndex | back to summary |
|---|---|
| private final int maxIndex | |
| minIndex | back to summary |
|---|---|
| private final int minIndex | |
| SIZE_TABLE | back to summary |
|---|---|
| private static final int[] SIZE_TABLE | |
| AdaptiveRecvByteBufAllocator | back to summary |
|---|---|
| public AdaptiveRecvByteBufAllocator() Creates a new predictor with the default parameters. With the default
parameters, the expected buffer size starts from | |
| AdaptiveRecvByteBufAllocator | back to summary |
|---|---|
| public AdaptiveRecvByteBufAllocator(int minimum, int initial, int maximum) Creates a new predictor with the specified parameters.
| |
| getSizeTableIndex | back to summary |
|---|---|
| private static int getSizeTableIndex(final int size) | |
| newHandle | back to summary |
|---|---|
| public RecvByteBufAllocator. Implements io. Doc from io. Deprecated as a consequence of 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 | back to summary |
|---|---|
| public AdaptiveRecvByteBufAllocator respectMaybeMoreData(boolean respectMaybeMoreData) Overrides io. Doc from io. Determine if future instances of
| |
Deprecated
as a consequence of DefaultMaxMessagesRecvByteBufAllocator.MaxMessageHandle being deprecated. See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private int | |
| private final int | |
| private final int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | guess()
Implements io. allocate(ByteBufAllocator) except that it does not allocate anything but just tells the
capacity.
|
| public void | lastBytesRead(int
The number of bytes from the previous read operation. This may be negative if an read error
occurs. If a negative value is seen it is expected to be return on the next call to
bytes)lastBytesRead(). A negative value will signal a termination condition enforced externally
to this class and is not required to be enforced in continueReading().Overrides io. Implements io. |
| public void | readComplete()
Overrides io. Implements io. |
| private void |
| decreaseNow | back to summary |
|---|---|
| private boolean decreaseNow | |
| index | back to summary |
|---|---|
| private int index | |
| maxIndex | back to summary |
|---|---|
| private final int maxIndex | |
| minIndex | back to summary |
|---|---|
| private final int minIndex | |
| nextReceiveBufferSize | back to summary |
|---|---|
| private int nextReceiveBufferSize | |
| HandleImpl | back to summary |
|---|---|
| pack-priv HandleImpl(int minIndex, int maxIndex, int initial) | |
| guess | back to summary |
|---|---|
| public int guess() Implements io. Doc from io. Similar to
| |
| lastBytesRead | back to summary |
|---|---|
| public void lastBytesRead(int bytes) Overrides io. Implements io. Doc from io. Set the bytes that have been read for the last read operation. This may be used to increment the number of bytes that have been read.
| |
| readComplete | back to summary |
|---|---|
| public void readComplete() Overrides io. Implements io. Doc from io. The read has completed.
| |
| record | back to summary |
|---|---|
| private void record(int actualReadBytes) | |