Skip to content

Commit ea8ebcb

Browse files
committed
- netty: cleanup pipeline for h2 (mainly)
1 parent 65b0a80 commit ea8ebcb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/jooby-netty/src/main/java/io/jooby/internal/netty/NettyPipeline.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.jooby.internal.netty;
77

88
import java.util.List;
9+
import java.util.concurrent.ScheduledExecutorService;
910

1011
import io.jooby.Context;
1112
import io.netty.buffer.ByteBuf;
@@ -76,7 +77,7 @@ public void initChannel(SocketChannel ch) {
7677
private void setupHttp11(ChannelPipeline p) {
7778
p.addLast("codec", createServerCodec());
7879
addCommonHandlers(p);
79-
p.addLast("handler", createHandler());
80+
p.addLast("handler", createHandler(p.channel().eventLoop()));
8081
}
8182

8283
private void setupHttp2(ChannelPipeline pipeline) {
@@ -102,7 +103,7 @@ private void setupHttp11Upgrade(ChannelPipeline pipeline) {
102103
(int) maxRequestSize));
103104

104105
addCommonHandlers(pipeline);
105-
pipeline.addLast("handler", createHandler());
106+
pipeline.addLast("handler", createHandler(pipeline.channel().eventLoop()));
106107
}
107108

108109
private ChannelInboundHandler setupHttp2Handshake(boolean secure) {
@@ -128,7 +129,7 @@ private Http2ServerUpgradeCodec createH2CUpgradeCodec() {
128129
new Http2MultiplexHandler(new Http2StreamInitializer(this)));
129130
}
130131

131-
private NettyHandler createHandler() {
132+
private NettyHandler createHandler(ScheduledExecutorService executor) {
132133
return new NettyHandler(
133134
dateService,
134135
contextSelector,
@@ -195,7 +196,7 @@ private static class Http2StreamInitializer extends ChannelInitializer<Channel>
195196
@Override
196197
protected void initChannel(Channel ch) {
197198
ch.pipeline().addLast("http2", new Http2StreamFrameToHttpObjectCodec(true));
198-
ch.pipeline().addLast("handler", pipeline.createHandler());
199+
ch.pipeline().addLast("handler", pipeline.createHandler(ch.eventLoop()));
199200
}
200201
}
201202
}

0 commit comments

Comments
 (0)