|
14 | 14 | import io.netty.channel.ChannelHandlerContext; |
15 | 15 | import io.netty.channel.ChannelInboundHandlerAdapter; |
16 | 16 | import io.netty.channel.embedded.EmbeddedChannel; |
17 | | - |
18 | 17 | import io.netty.handler.codec.http.DefaultHttpContent; |
19 | 18 | import io.netty.handler.codec.http.DefaultHttpRequest; |
20 | 19 | import io.netty.handler.codec.http.DefaultLastHttpContent; |
21 | 20 | import io.netty.handler.codec.http.HttpContent; |
22 | 21 | import io.netty.handler.codec.http.HttpMethod; |
23 | 22 | import io.netty.handler.codec.http.HttpRequest; |
24 | | - |
25 | 23 | import io.netty.handler.codec.http.HttpVersion; |
26 | | - |
27 | 24 | import io.netty.handler.codec.http.LastHttpContent; |
28 | 25 |
|
29 | 26 | import org.elasticsearch.action.ActionListener; |
| 27 | +import org.elasticsearch.common.network.ThreadWatchdog; |
30 | 28 | import org.elasticsearch.common.settings.Settings; |
31 | 29 | import org.elasticsearch.common.util.concurrent.ThreadContext; |
32 | 30 | import org.elasticsearch.http.HttpBody; |
|
42 | 40 |
|
43 | 41 | public class AutoReadSyncTests extends ESTestCase { |
44 | 42 |
|
| 43 | + static final int BUF_SIZE = 1024; |
45 | 44 | Channel chan; |
46 | 45 |
|
47 | 46 | @Override |
@@ -119,8 +118,6 @@ public void testAllTogglesEnableAutoRead() { |
119 | 118 | assertTrue(chan.config().isAutoRead()); |
120 | 119 | } |
121 | 120 |
|
122 | | - static final int BUF_SIZE = 1024; |
123 | | - |
124 | 121 | /** |
125 | 122 | * Ensure that HttpStream does not set auto-read true when there is request waiting for auth. |
126 | 123 | * This test emulates reception of a large TCP packet that contains 2 HTTP requests and using HTTP pipelining. |
@@ -182,7 +179,11 @@ class StreamHandler extends ChannelInboundHandlerAdapter { |
182 | 179 | @Override |
183 | 180 | public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { |
184 | 181 | if (msg instanceof HttpRequest) { |
185 | | - var stream = new Netty4HttpRequestBodyStream(ctx.channel(), new ThreadContext(Settings.EMPTY)); |
| 182 | + var stream = new Netty4HttpRequestBodyStream( |
| 183 | + ctx.channel(), |
| 184 | + new ThreadContext(Settings.EMPTY), |
| 185 | + new ThreadWatchdog.ActivityTracker() |
| 186 | + ); |
186 | 187 | streams.add(stream); |
187 | 188 | stream.setHandler(discardChunk); |
188 | 189 | } else { |
|
0 commit comments