MaxMessageHandle Class — netty Architecture
Architecture documentation for the MaxMessageHandle class in DefaultMaxMessagesRecvByteBufAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 210addab_3e2b_6227_c258_ee63bb179515["MaxMessageHandle"] dbaa41b6_d847_4a41_5726_7a88eeb05f45["DefaultMaxMessagesRecvByteBufAllocator.java"] 210addab_3e2b_6227_c258_ee63bb179515 -->|defined in| dbaa41b6_d847_4a41_5726_7a88eeb05f45 8388fb77_56fa_4418_bb7a_4d34054052be["reset()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| 8388fb77_56fa_4418_bb7a_4d34054052be 39eb8814_2a03_c5d4_5c9b_cc631d7226b4["ByteBuf()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| 39eb8814_2a03_c5d4_5c9b_cc631d7226b4 136894a7_1d1b_2eb6_bdf0_d7c80e8fc10a["incMessagesRead()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| 136894a7_1d1b_2eb6_bdf0_d7c80e8fc10a b13d7e2c_6e7d_5b74_7623_e29a1ffd980b["lastBytesRead()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| b13d7e2c_6e7d_5b74_7623_e29a1ffd980b 81d9a847_bd3a_fcce_fe97_33e83d0abfb7["continueReading()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| 81d9a847_bd3a_fcce_fe97_33e83d0abfb7 87407623_847b_8a82_17a6_8d0af6345c26["readComplete()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| 87407623_847b_8a82_17a6_8d0af6345c26 cbc3de17_5296_0d71_3149_776352b2ce60["attemptedBytesRead()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| cbc3de17_5296_0d71_3149_776352b2ce60 c8c07d84_7cdb_abd1_a941_bdd9fb4fc732["totalBytesRead()"] 210addab_3e2b_6227_c258_ee63bb179515 -->|method| c8c07d84_7cdb_abd1_a941_bdd9fb4fc732
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/DefaultMaxMessagesRecvByteBufAllocator.java lines 93–170
public abstract class MaxMessageHandle implements ExtendedHandle {
private ChannelConfig config;
private int maxMessagePerRead;
private int totalMessages;
private int totalBytesRead;
private int attemptedBytesRead;
private int lastBytesRead;
private final boolean respectMaybeMoreData = DefaultMaxMessagesRecvByteBufAllocator.this.respectMaybeMoreData;
private final UncheckedBooleanSupplier defaultMaybeMoreSupplier = new UncheckedBooleanSupplier() {
@Override
public boolean get() {
return attemptedBytesRead == lastBytesRead;
}
};
/**
* Only {@link ChannelConfig#getMaxMessagesPerRead()} is used.
*/
@Override
public void reset(ChannelConfig config) {
this.config = config;
maxMessagePerRead = maxMessagesPerRead();
totalMessages = totalBytesRead = 0;
}
@Override
public ByteBuf allocate(ByteBufAllocator alloc) {
return alloc.ioBuffer(guess());
}
@Override
public final void incMessagesRead(int amt) {
totalMessages += amt;
}
@Override
public void lastBytesRead(int bytes) {
lastBytesRead = bytes;
if (bytes > 0) {
totalBytesRead += bytes;
}
}
@Override
public final int lastBytesRead() {
return lastBytesRead;
}
@Override
public boolean continueReading() {
return continueReading(defaultMaybeMoreSupplier);
}
@Override
public boolean continueReading(UncheckedBooleanSupplier maybeMoreDataSupplier) {
return config.isAutoRead() &&
(!respectMaybeMoreData || maybeMoreDataSupplier.get()) &&
totalMessages < maxMessagePerRead && (ignoreBytesRead || totalBytesRead > 0);
}
@Override
public void readComplete() {
}
@Override
public int attemptedBytesRead() {
return attemptedBytesRead;
}
@Override
public void attemptedBytesRead(int bytes) {
attemptedBytesRead = bytes;
}
protected final int totalBytesRead() {
return totalBytesRead < 0 ? Integer.MAX_VALUE : totalBytesRead;
}
}
Source
Frequently Asked Questions
What is the MaxMessageHandle class?
MaxMessageHandle is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/DefaultMaxMessagesRecvByteBufAllocator.java.
Where is MaxMessageHandle defined?
MaxMessageHandle is defined in transport/src/main/java/io/netty/channel/DefaultMaxMessagesRecvByteBufAllocator.java at line 93.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free