add() — netty Function Reference
Architecture documentation for the add() function in PendingWriteQueue.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9045a57d_5230_2357_4ef7_f61e7cee74ba["add()"] 83722386_341f_50b9_cd3a_d141138801ae["PendingWriteQueue"] 9045a57d_5230_2357_4ef7_f61e7cee74ba -->|defined in| 83722386_341f_50b9_cd3a_d141138801ae 58e262d9_3782_2194_e391_e963af8a705d["ChannelFuture()"] 58e262d9_3782_2194_e391_e963af8a705d -->|calls| 9045a57d_5230_2357_4ef7_f61e7cee74ba 9465da28_383b_e0f3_4e91_d1dcedaa5bdf["removeAndFailAll()"] 9045a57d_5230_2357_4ef7_f61e7cee74ba -->|calls| 9465da28_383b_e0f3_4e91_d1dcedaa5bdf 46561650_a7c0_09b3_f8da_a4d1c4544d81["size()"] 9045a57d_5230_2357_4ef7_f61e7cee74ba -->|calls| 46561650_a7c0_09b3_f8da_a4d1c4544d81 style 9045a57d_5230_2357_4ef7_f61e7cee74ba fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/PendingWriteQueue.java lines 104–132
public void add(Object msg, ChannelPromise promise) {
assert executor.inEventLoop();
ObjectUtil.checkNotNull(msg, "msg");
ObjectUtil.checkNotNull(promise, "promise");
// It is possible for writes to be triggered from removeAndFailAll(). To preserve ordering,
// we should add them to the queue and let removeAndFailAll() fail them later.
int messageSize = size(msg);
PendingWrite write = PendingWrite.newInstance(msg, messageSize, promise);
PendingWrite currentTail = tail;
if (currentTail == null) {
tail = head = write;
} else {
currentTail.next = write;
tail = write;
}
size ++;
bytes += messageSize;
tracker.incrementPendingOutboundBytes(write.size);
// Touch the message to make it easier to debug buffer leaks.
// this save both checking against the ReferenceCounted interface
// and makes better use of virtual calls vs interface ones
if (msg instanceof AbstractReferenceCountedByteBuf) {
((AbstractReferenceCountedByteBuf) msg).touch();
} else {
ReferenceCountUtil.touch(msg);
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does add() do?
add() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/PendingWriteQueue.java.
Where is add() defined?
add() is defined in transport/src/main/java/io/netty/channel/PendingWriteQueue.java at line 104.
What does add() call?
add() calls 2 function(s): removeAndFailAll, size.
What calls add()?
add() is called by 1 function(s): ChannelFuture.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free