Add TCP_NODELAY flag to HttpSnoopServer example
This commit is contained in:
parent
e9c5f4fa9a
commit
b21b8aef2f
@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.jboss.netty.example.http.snoop;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* An HTTP server that sends back the content of the received HTTP request
|
||||
* in a pretty plaintext form.
|
||||
@ -40,6 +40,9 @@ public class HttpSnoopServer {
|
||||
Executors.newCachedThreadPool(),
|
||||
Executors.newCachedThreadPool()));
|
||||
|
||||
// Enable TCP_NODELAY to handle pipelined requests without latency.
|
||||
bootstrap.setOption("child.tcpNoDelay", true);
|
||||
|
||||
// Set up the event pipeline factory.
|
||||
bootstrap.setPipelineFactory(new HttpSnoopServerPipelineFactory());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user