doWrite() — netty Function Reference
Architecture documentation for the doWrite() function in AbstractEpollStreamChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 45b68c03_a456_a0b0_0f4a_03ba140e0340["doWrite()"] 6ec314cd_b42f_72bd_344b_f54212398142["AbstractEpollStreamChannel"] 45b68c03_a456_a0b0_0f4a_03ba140e0340 -->|defined in| 6ec314cd_b42f_72bd_344b_f54212398142 f600792f_4dbb_bbbf_2f55_5060e177423d["doWriteMultiple()"] 45b68c03_a456_a0b0_0f4a_03ba140e0340 -->|calls| f600792f_4dbb_bbbf_2f55_5060e177423d 6f923dac_2ab4_45b4_f2b7_ac945384fb3c["doWriteSingle()"] 45b68c03_a456_a0b0_0f4a_03ba140e0340 -->|calls| 6f923dac_2ab4_45b4_f2b7_ac945384fb3c style 45b68c03_a456_a0b0_0f4a_03ba140e0340 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java lines 422–458
@Override
protected void doWrite(ChannelOutboundBuffer in) throws Exception {
int writeSpinCount = config().getWriteSpinCount();
do {
final int msgCount = in.size();
// Do gathering write if the outbound buffer entries start with more than one ByteBuf.
if (msgCount > 1 && in.current() instanceof ByteBuf) {
writeSpinCount -= doWriteMultiple(in);
} else if (msgCount == 0) {
// Wrote all messages.
clearFlag(Native.EPOLLOUT);
// Return here so we not set the EPOLLOUT flag.
return;
} else { // msgCount == 1
writeSpinCount -= doWriteSingle(in);
}
// We do not break the loop here even if the outbound buffer was flushed completely,
// because a user might have triggered another write and flush when we notify his or her
// listeners.
} while (writeSpinCount > 0);
if (writeSpinCount == 0) {
// It is possible that we have set EPOLLOUT, woken up by EPOLL because the socket is writable, and then use
// our write quantum. In this case we no longer want to set the EPOLLOUT flag because the socket is still
// writable (as far as we know). We will find out next time we attempt to write if the socket is writable
// and set the EPOLLOUT if necessary.
clearFlag(Native.EPOLLOUT);
// We used our writeSpin quantum, and should try to write again later.
eventLoop().execute(flushTask);
} else {
// Underlying descriptor can not accept all data currently, so set the EPOLLOUT flag to be woken up
// when it can accept more data.
setFlag(Native.EPOLLOUT);
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does doWrite() do?
doWrite() is a function in the netty codebase, defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java.
Where is doWrite() defined?
doWrite() is defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java at line 422.
What does doWrite() call?
doWrite() calls 2 function(s): doWriteMultiple, doWriteSingle.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free