Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2704#discussion_r193461968
--- Diff:
storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java ---
@@ -100,23 +99,25 @@ public PacemakerClient(Map<String, Object> config,
String host) {
ready = new AtomicBoolean(false);
shutdown = new AtomicBoolean(false);
- channelRef = new AtomicReference<Channel>(null);
+ channelRef = new AtomicReference<>(null);
setupMessaging();
- ThreadFactory bossFactory = new
NettyRenameThreadFactory("client-boss");
ThreadFactory workerFactory = new
NettyRenameThreadFactory("client-worker");
- NioClientSocketChannelFactory factory =
- new
NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory),
Executors.newCachedThreadPool(workerFactory));
- bootstrap = new ClientBootstrap(factory);
- bootstrap.setOption("tcpNoDelay", true);
- bootstrap.setOption("sendBufferSize", 5242880);
- bootstrap.setOption("keepAlive", true);
+ // 0 means DEFAULT_EVENT_LOOP_THREADS
+ //
https://github.com/netty/netty/blob/netty-4.1.24.Final/transport/src/main/java/io/netty/channel/MultithreadEventLoopGroup.java#L40
+ this.workerEventLoopGroup = new NioEventLoopGroup(maxWorkers > 0 ?
maxWorkers : 0, workerFactory);
+ int thriftMessageMaxSize = (Integer)
config.get(Config.PACEMAKER_THRIFT_MESSAGE_SIZE_MAX);
+ bootstrap = new Bootstrap()
+ .group(workerEventLoopGroup)
+ .channel(NioSocketChannel.class)
+ .option(ChannelOption.TCP_NODELAY, true)
+ .option(ChannelOption.SO_SNDBUF, 5242880)
+ .option(ChannelOption.SO_KEEPALIVE, true)
+ .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new
WriteBufferWaterMark(8 * 1024, 32 * 1024))
+ .option(ChannelOption.ALLOCATOR,
PooledByteBufAllocator.DEFAULT)
--- End diff --
It's not the same block. The code is different in Server
---