Skip to content

Commit d4f5bab

Browse files
authored
netty: enable AdaptiveCumulator (#13100)
1 parent 5ecce90 commit d4f5bab

3 files changed

Lines changed: 7 additions & 886 deletions

File tree

‎netty/src/main/java/io/grpc/netty/GrpcHttp2ConnectionHandler.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import io.grpc.Internal;
2424
import io.grpc.InternalChannelz;
2525
import io.netty.channel.ChannelPromise;
26+
import io.netty.handler.codec.AdaptiveCumulator;
27+
import io.netty.handler.codec.ByteToMessageDecoder.Cumulator;
2628
import io.netty.handler.codec.http2.Http2ConnectionDecoder;
2729
import io.netty.handler.codec.http2.Http2ConnectionEncoder;
2830
import io.netty.handler.codec.http2.Http2ConnectionHandler;
@@ -34,6 +36,10 @@
3436
*/
3537
@Internal
3638
public abstract class GrpcHttp2ConnectionHandler extends Http2ConnectionHandler {
39+
private static final int ADAPTIVE_CUMULATOR_COMPOSE_MIN_SIZE_DEFAULT = 1024;
40+
private static final Cumulator ADAPTIVE_CUMULATOR =
41+
new AdaptiveCumulator(ADAPTIVE_CUMULATOR_COMPOSE_MIN_SIZE_DEFAULT);
42+
3743
@Nullable
3844
protected final ChannelPromise channelUnused;
3945
private final ChannelLogger negotiationLogger;
@@ -48,6 +54,7 @@ protected GrpcHttp2ConnectionHandler(
4854
super(decoder, encoder, initialSettings);
4955
this.channelUnused = channelUnused;
5056
this.negotiationLogger = negotiationLogger;
57+
setCumulator(ADAPTIVE_CUMULATOR);
5158
}
5259

5360
/**

‎netty/src/main/java/io/grpc/netty/NettyAdaptiveCumulator.java‎

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)