use of org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory in project pinpoint by naver.
the class PinpointServerAcceptor method createBootStrap.
private ServerBootstrap createBootStrap(int bossCount, int workerCount) {
// profiler, collector
ExecutorService boss = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Server-Boss"));
NioServerBossPool nioServerBossPool = new NioServerBossPool(boss, bossCount, ThreadNameDeterminer.CURRENT);
ExecutorService worker = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Server-Worker"));
NioWorkerPool nioWorkerPool = new NioWorkerPool(worker, workerCount, ThreadNameDeterminer.CURRENT);
NioServerSocketChannelFactory nioClientSocketChannelFactory = new NioServerSocketChannelFactory(nioServerBossPool, nioWorkerPool);
return new ServerBootstrap(nioClientSocketChannelFactory);
}
use of org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850Config method serverBootstrap.
/**
* Returns a ServerBootstrap setting up a server pipeline listening for
* incoming IEC61850 register device requests.
*
* @return an IEC61850 server bootstrap.
*/
@Bean(destroyMethod = "releaseExternalResources")
public ServerBootstrap serverBootstrap() {
final ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
final ServerBootstrap bootstrap = new ServerBootstrap(factory);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws ProtocolAdapterException {
final ChannelPipeline pipeline = Iec61850Config.this.createChannelPipeline(Iec61850Config.this.iec61850ChannelHandlerServer());
LOGGER.info("Created new IEC61850 handler pipeline for server");
return pipeline;
}
});
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.setOption("child.keepAlive", false);
bootstrap.bind(new InetSocketAddress(this.iec61850PortListener()));
return bootstrap;
}
Aggregations