doReadMessages() — netty Function Reference
Architecture documentation for the doReadMessages() function in NioDatagramChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 548080ac_69c8_ae1a_5c1b_74c5509ca5f1["doReadMessages()"] 62bb7cb5_86a2_a73b_659d_4f8936fbd7b8["NioDatagramChannel"] 548080ac_69c8_ae1a_5c1b_74c5509ca5f1 -->|defined in| 62bb7cb5_86a2_a73b_659d_4f8936fbd7b8 style 548080ac_69c8_ae1a_5c1b_74c5509ca5f1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java lines 252–282
@Override
protected int doReadMessages(List<Object> buf) throws Exception {
DatagramChannel ch = javaChannel();
DatagramChannelConfig config = config();
RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
ByteBuf data = allocHandle.allocate(config.getAllocator());
allocHandle.attemptedBytesRead(data.writableBytes());
boolean free = true;
try {
ByteBuffer nioData = data.internalNioBuffer(data.writerIndex(), data.writableBytes());
int pos = nioData.position();
InetSocketAddress remoteAddress = (InetSocketAddress) ch.receive(nioData);
if (remoteAddress == null) {
return 0;
}
allocHandle.lastBytesRead(nioData.position() - pos);
buf.add(new DatagramPacket(data.writerIndex(data.writerIndex() + allocHandle.lastBytesRead()),
localAddress(), remoteAddress));
free = false;
return 1;
} catch (Throwable cause) {
PlatformDependent.throwException(cause);
return -1;
} finally {
if (free) {
data.release();
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does doReadMessages() do?
doReadMessages() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java.
Where is doReadMessages() defined?
doReadMessages() is defined in transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java at line 252.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free