Skip to content

Commit f5a608d

Browse files
committed
update
1 parent c905329 commit f5a608d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/AutoReadSyncTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@
1414
import io.netty.channel.ChannelHandlerContext;
1515
import io.netty.channel.ChannelInboundHandlerAdapter;
1616
import io.netty.channel.embedded.EmbeddedChannel;
17-
1817
import io.netty.handler.codec.http.DefaultHttpContent;
1918
import io.netty.handler.codec.http.DefaultHttpRequest;
2019
import io.netty.handler.codec.http.DefaultLastHttpContent;
2120
import io.netty.handler.codec.http.HttpContent;
2221
import io.netty.handler.codec.http.HttpMethod;
2322
import io.netty.handler.codec.http.HttpRequest;
24-
2523
import io.netty.handler.codec.http.HttpVersion;
26-
2724
import io.netty.handler.codec.http.LastHttpContent;
2825

2926
import org.elasticsearch.action.ActionListener;
27+
import org.elasticsearch.common.network.ThreadWatchdog;
3028
import org.elasticsearch.common.settings.Settings;
3129
import org.elasticsearch.common.util.concurrent.ThreadContext;
3230
import org.elasticsearch.http.HttpBody;
@@ -42,6 +40,7 @@
4240

4341
public class AutoReadSyncTests extends ESTestCase {
4442

43+
static final int BUF_SIZE = 1024;
4544
Channel chan;
4645

4746
@Override
@@ -119,8 +118,6 @@ public void testAllTogglesEnableAutoRead() {
119118
assertTrue(chan.config().isAutoRead());
120119
}
121120

122-
static final int BUF_SIZE = 1024;
123-
124121
/**
125122
* Ensure that HttpStream does not set auto-read true when there is request waiting for auth.
126123
* 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 {
182179
@Override
183180
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
184181
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+
);
186187
streams.add(stream);
187188
stream.setHandler(discardChunk);
188189
} else {

0 commit comments

Comments
 (0)