private NioServerSocketChannelFactory initSocketChannelFactory() {
NioServerSocketChannelFactory socketChannelFactory;
if (maxThreads <= 0) {
socketChannelFactory = new NioServerSocketChannelFactory
(Executors.newCachedThreadPool(new ThreadFactoryBuilder().
setNameFormat("Avro " + NettyTransceiver.class.getSimpleName()
+ " Boss-%d").build()),
Executors.newCachedThreadPool(new ThreadFactoryBuilder().
setNameFormat("Avro " + NettyTransceiver.class.getSimpleName()
+ " I/O Worker-%d").build()));
} else {
socketChannelFactory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(new ThreadFactoryBuilder().
setNameFormat(
"Avro " + NettyTransceiver.class.getSimpleName()
+ " Boss-%d").build()),
Executors.newFixedThreadPool(maxThreads, new ThreadFactoryBuilder().
setNameFormat("Avro " + NettyTransceiver.class.getSimpleName() +
" I/O Worker-%d").build()));
}
return socketChannelFactory;
}