class EpollRecvByteAllocatorHandle extends java.lang.Object implements RecvByteBufAllocator.ExtendedHandle
Modifier and Type | Field and Description |
---|---|
private UncheckedBooleanSupplier |
defaultMaybeMoreDataSupplier |
private RecvByteBufAllocator.ExtendedHandle |
delegate |
private boolean |
isEdgeTriggered |
private boolean |
receivedRdHup |
Constructor and Description |
---|
EpollRecvByteAllocatorHandle(RecvByteBufAllocator.ExtendedHandle handle) |
Modifier and Type | Method and Description |
---|---|
ByteBuf |
allocate(ByteBufAllocator alloc)
Creates a new receive buffer whose capacity is probably large enough to read all inbound data and small
enough not to waste its space.
|
int |
attemptedBytesRead()
Get how many bytes the read operation will (or did) attempt to read.
|
void |
attemptedBytesRead(int bytes)
Set how many bytes the read operation will (or did) attempt to read.
|
boolean |
continueReading()
Determine if the current read loop should should continue.
|
boolean |
continueReading(UncheckedBooleanSupplier maybeMoreDataSupplier)
Same as
RecvByteBufAllocator.Handle.continueReading() except "more data" is determined by the supplier parameter. |
(package private) void |
edgeTriggered(boolean edgeTriggered) |
int |
guess()
Similar to
RecvByteBufAllocator.Handle.allocate(ByteBufAllocator) except that it does not allocate anything but just tells the
capacity. |
void |
incMessagesRead(int numMessages)
Increment the number of messages that have been read for the current read loop.
|
(package private) boolean |
isEdgeTriggered() |
(package private) boolean |
isReceivedRdHup() |
int |
lastBytesRead()
Get the amount of bytes for the previous read operation.
|
void |
lastBytesRead(int bytes)
Set the bytes that have been read for the last read operation.
|
(package private) boolean |
maybeMoreDataToRead() |
void |
readComplete()
The read has completed.
|
(package private) void |
receivedRdHup() |
void |
reset(ChannelConfig config)
Reset any counters that have accumulated and recommend how many messages/bytes should be read for the next
read loop.
|
private final RecvByteBufAllocator.ExtendedHandle delegate
private final UncheckedBooleanSupplier defaultMaybeMoreDataSupplier
private boolean isEdgeTriggered
private boolean receivedRdHup
EpollRecvByteAllocatorHandle(RecvByteBufAllocator.ExtendedHandle handle)
final void receivedRdHup()
final boolean isReceivedRdHup()
boolean maybeMoreDataToRead()
final void edgeTriggered(boolean edgeTriggered)
final boolean isEdgeTriggered()
public final ByteBuf allocate(ByteBufAllocator alloc)
RecvByteBufAllocator.Handle
allocate
in interface RecvByteBufAllocator.Handle
public final int guess()
RecvByteBufAllocator.Handle
RecvByteBufAllocator.Handle.allocate(ByteBufAllocator)
except that it does not allocate anything but just tells the
capacity.guess
in interface RecvByteBufAllocator.Handle
public final void reset(ChannelConfig config)
RecvByteBufAllocator.Handle
This may be used by RecvByteBufAllocator.Handle.continueReading()
to determine if the read operation should complete.
reset
in interface RecvByteBufAllocator.Handle
config
- The channel configuration which may impact this object's behavior.public final void incMessagesRead(int numMessages)
RecvByteBufAllocator.Handle
incMessagesRead
in interface RecvByteBufAllocator.Handle
numMessages
- The amount to increment by.public final void lastBytesRead(int bytes)
RecvByteBufAllocator.Handle
lastBytesRead
in interface RecvByteBufAllocator.Handle
bytes
- 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
RecvByteBufAllocator.Handle.lastBytesRead()
. A negative value will signal a termination condition enforced externally
to this class and is not required to be enforced in RecvByteBufAllocator.Handle.continueReading()
.public final int lastBytesRead()
RecvByteBufAllocator.Handle
lastBytesRead
in interface RecvByteBufAllocator.Handle
public final int attemptedBytesRead()
RecvByteBufAllocator.Handle
attemptedBytesRead
in interface RecvByteBufAllocator.Handle
public final void attemptedBytesRead(int bytes)
RecvByteBufAllocator.Handle
attemptedBytesRead
in interface RecvByteBufAllocator.Handle
bytes
- How many bytes the read operation will (or did) attempt to read.public final void readComplete()
RecvByteBufAllocator.Handle
readComplete
in interface RecvByteBufAllocator.Handle
public final boolean continueReading(UncheckedBooleanSupplier maybeMoreDataSupplier)
RecvByteBufAllocator.ExtendedHandle
RecvByteBufAllocator.Handle.continueReading()
except "more data" is determined by the supplier parameter.continueReading
in interface RecvByteBufAllocator.ExtendedHandle
maybeMoreDataSupplier
- A supplier that determines if there maybe more data to read.public final boolean continueReading()
RecvByteBufAllocator.Handle
continueReading
in interface RecvByteBufAllocator.Handle
true
if the read loop should continue reading. false
if the read loop is complete.