Upgrade to Netty 3.5.2, closes #2084.

This commit is contained in:
Shay Banon 2012-07-05 23:09:26 +02:00
parent 57023c8ba9
commit 5f1b1c6f69
2 changed files with 11 additions and 2 deletions

View File

@ -140,7 +140,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty</artifactId> <artifactId>netty</artifactId>
<version>3.5.1.Final</version> <version>3.5.2.Final</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -95,6 +95,7 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
private final ByteSizeValue tcpReceiveBufferSize; private final ByteSizeValue tcpReceiveBufferSize;
final ByteSizeValue maxCumulationBufferCapacity; final ByteSizeValue maxCumulationBufferCapacity;
final int maxCompositeBufferComponents;
private volatile ServerBootstrap serverBootstrap; private volatile ServerBootstrap serverBootstrap;
@ -118,6 +119,7 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
// note, parsing cookies was fixed in netty 3.5.1 regarding stack allocation, but still, currently, we don't need cookies // note, parsing cookies was fixed in netty 3.5.1 regarding stack allocation, but still, currently, we don't need cookies
this.resetCookies = componentSettings.getAsBoolean("reset_cookies", settings.getAsBoolean("http.reset_cookies", false)); this.resetCookies = componentSettings.getAsBoolean("reset_cookies", settings.getAsBoolean("http.reset_cookies", false));
this.maxCumulationBufferCapacity = componentSettings.getAsBytesSize("max_cumulation_buffer_capacity", null); this.maxCumulationBufferCapacity = componentSettings.getAsBytesSize("max_cumulation_buffer_capacity", null);
this.maxCompositeBufferComponents = componentSettings.getAsInt("max_composite_buffer_components", -1);
this.workerCount = componentSettings.getAsInt("worker_count", Runtime.getRuntime().availableProcessors() * 2); this.workerCount = componentSettings.getAsInt("worker_count", Runtime.getRuntime().availableProcessors() * 2);
this.blockingServer = settings.getAsBoolean("http.blocking_server", settings.getAsBoolean(TCP_BLOCKING_SERVER, settings.getAsBoolean(TCP_BLOCKING, false))); this.blockingServer = settings.getAsBoolean("http.blocking_server", settings.getAsBoolean(TCP_BLOCKING_SERVER, settings.getAsBoolean(TCP_BLOCKING, false)));
this.port = componentSettings.get("port", settings.get("http.port", "9200-9300")); this.port = componentSettings.get("port", settings.get("http.port", "9200-9300"));
@ -303,11 +305,18 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
requestDecoder.setMaxCumulationBufferCapacity((int) transport.maxCumulationBufferCapacity.bytes()); requestDecoder.setMaxCumulationBufferCapacity((int) transport.maxCumulationBufferCapacity.bytes());
} }
} }
if (transport.maxCompositeBufferComponents != -1) {
requestDecoder.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents);
}
pipeline.addLast("decoder", requestDecoder); pipeline.addLast("decoder", requestDecoder);
if (transport.compression) { if (transport.compression) {
pipeline.addLast("decoder_compress", new HttpContentDecompressor()); pipeline.addLast("decoder_compress", new HttpContentDecompressor());
} }
pipeline.addLast("aggregator", new HttpChunkAggregator((int) transport.maxContentLength.bytes())); HttpChunkAggregator httpChunkAggregator = new HttpChunkAggregator((int) transport.maxContentLength.bytes());
if (transport.maxCompositeBufferComponents != -1) {
httpChunkAggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents);
}
pipeline.addLast("aggregator", httpChunkAggregator);
pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("encoder", new HttpResponseEncoder());
if (transport.compression) { if (transport.compression) {
pipeline.addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel)); pipeline.addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel));