|
51 | 51 | import org.jboss.netty.channel.*; |
52 | 52 | import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; |
53 | 53 | import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; |
| 54 | +import org.jboss.netty.channel.socket.nio.NioWorkerPool; |
54 | 55 | import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; |
55 | 56 | import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; |
| 57 | +import org.jboss.netty.util.HashedWheelTimer; |
56 | 58 |
|
57 | 59 | import java.io.IOException; |
58 | 60 | import java.net.InetAddress; |
@@ -93,6 +95,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem |
93 | 95 | private final NetworkService networkService; |
94 | 96 |
|
95 | 97 | final int workerCount; |
| 98 | + final int bossCount; |
96 | 99 |
|
97 | 100 | final boolean blockingServer; |
98 | 101 |
|
@@ -172,6 +175,7 @@ public NettyTransport(Settings settings, ThreadPool threadPool, NetworkService n |
172 | 175 | } |
173 | 176 |
|
174 | 177 | this.workerCount = componentSettings.getAsInt("worker_count", Runtime.getRuntime().availableProcessors() * 2); |
| 178 | + this.bossCount = componentSettings.getAsInt("boss_count", 1); |
175 | 179 | this.blockingServer = settings.getAsBoolean("transport.tcp.blocking_server", settings.getAsBoolean(TCP_BLOCKING_SERVER, settings.getAsBoolean(TCP_BLOCKING, false))); |
176 | 180 | this.blockingClient = settings.getAsBoolean("transport.tcp.blocking_client", settings.getAsBoolean(TCP_BLOCKING_CLIENT, settings.getAsBoolean(TCP_BLOCKING, false))); |
177 | 181 | this.port = componentSettings.get("port", settings.get("transport.tcp.port", "9300-9400")); |
@@ -235,8 +239,9 @@ protected void doStart() throws ElasticSearchException { |
235 | 239 | } else { |
236 | 240 | clientBootstrap = new ClientBootstrap(new NioClientSocketChannelFactory( |
237 | 241 | Executors.newCachedThreadPool(daemonThreadFactory(settings, "transport_client_boss")), |
238 | | - Executors.newCachedThreadPool(daemonThreadFactory(settings, "transport_client_worker")), |
239 | | - workerCount)); |
| 242 | + bossCount, |
| 243 | + new NioWorkerPool(Executors.newCachedThreadPool(daemonThreadFactory(settings, "transport_client_worker")), workerCount), |
| 244 | + new HashedWheelTimer(daemonThreadFactory(settings, "transport_client_timer")))); |
240 | 245 | } |
241 | 246 | ChannelPipelineFactory clientPipelineFactory = new ChannelPipelineFactory() { |
242 | 247 | @Override |
|
0 commit comments