write() — netty Function Reference
Architecture documentation for the write() function in AbstractChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ab3014f1_ecc6_2385_572a_896945c2111a["write()"] 330d05c9_85ca_2e57_92f5_e996fb442b81["AbstractUnsafe"] ab3014f1_ecc6_2385_572a_896945c2111a -->|defined in| 330d05c9_85ca_2e57_92f5_e996fb442b81 30686258_744e_d516_027d_4264d61dbea3["assertEventLoop()"] ab3014f1_ecc6_2385_572a_896945c2111a -->|calls| 30686258_744e_d516_027d_4264d61dbea3 ae5386b7_9fd3_54fd_2f3c_29a33b11e74f["flush0()"] ab3014f1_ecc6_2385_572a_896945c2111a -->|calls| ae5386b7_9fd3_54fd_2f3c_29a33b11e74f 09594916_b369_0dde_fab6_d2f3c2bd81b1["safeSetFailure()"] ab3014f1_ecc6_2385_572a_896945c2111a -->|calls| 09594916_b369_0dde_fab6_d2f3c2bd81b1 style ab3014f1_ecc6_2385_572a_896945c2111a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/AbstractChannel.java lines 709–746
@Override
public final void write(Object msg, ChannelPromise promise) {
assertEventLoop();
ChannelOutboundBuffer outboundBuffer = this.outboundBuffer;
if (outboundBuffer == null) {
try {
// release message now to prevent resource-leak
ReferenceCountUtil.release(msg);
} finally {
// If the outboundBuffer is null we know the channel was closed and so
// need to fail the future right away. If it is not null the handling of the rest
// will be done in flush0()
// See https://github.com/netty/netty/issues/2362
safeSetFailure(promise,
newClosedChannelException(initialCloseCause, "write(Object, ChannelPromise)"));
}
return;
}
int size;
try {
msg = filterOutboundMessage(msg);
size = pipeline.estimatorHandle().size(msg);
if (size < 0) {
size = 0;
}
} catch (Throwable t) {
try {
ReferenceCountUtil.release(msg);
} finally {
safeSetFailure(promise, t);
}
return;
}
outboundBuffer.addMessage(msg, size, promise);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does write() do?
write() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/AbstractChannel.java.
Where is write() defined?
write() is defined in transport/src/main/java/io/netty/channel/AbstractChannel.java at line 709.
What does write() call?
write() calls 3 function(s): assertEventLoop, flush0, safeSetFailure.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free