use of org.jboss.netty.channel.socket.nio.NioClientBossPool in project weave by continuuity.
the class SimpleKafkaClient method startUp.
@Override
protected void startUp() throws Exception {
brokerCache.startAndWait();
ThreadFactory threadFactory = Threads.createDaemonThreadFactory("kafka-client-netty-%d");
NioClientBossPool bossPool = new NioClientBossPool(Executors.newSingleThreadExecutor(threadFactory), 1, new HashedWheelTimer(threadFactory), null);
NioWorkerPool workerPool = new NioWorkerPool(Executors.newFixedThreadPool(4, threadFactory), 4);
bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(bossPool, workerPool));
bootstrap.setPipelineFactory(new KafkaChannelPipelineFactory());
connectionPool = new ConnectionPool(bootstrap);
}
use of org.jboss.netty.channel.socket.nio.NioClientBossPool in project cdap by caskdata.
the class NettyRouter method bootstrapClient.
private void bootstrapClient(final ChannelUpstreamHandler connectionTracker) {
ExecutorService clientBossExecutor = createExecutorService(clientBossThreadPoolSize, "router-client-boss-thread-%d");
ExecutorService clientWorkerExecutor = createExecutorService(clientWorkerThreadPoolSize, "router-client-worker-thread-%d");
clientBootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(new NioClientBossPool(clientBossExecutor, clientBossThreadPoolSize), new NioWorkerPool(clientWorkerExecutor, clientWorkerThreadPoolSize)));
ChannelPipelineFactory pipelineFactory = new ClientChannelPipelineFactory(connectionTracker, connectionTimeout, timer);
clientBootstrap.setPipelineFactory(pipelineFactory);
clientBootstrap.setOption("bufferFactory", new DirectChannelBufferFactory());
}
use of org.jboss.netty.channel.socket.nio.NioClientBossPool in project pinpoint by naver.
the class ClientChannelFactory method createChannelFactory.
public ChannelFactory createChannelFactory(int bossCount, int workerCount, Timer timer) {
ExecutorService boss = newCachedThreadPool("Pinpoint-Client-Boss");
BossPool bossPool = new NioClientBossPool(boss, bossCount, timer, ThreadNameDeterminer.CURRENT);
ExecutorService worker = newCachedThreadPool("Pinpoint-Client-Worker");
WorkerPool workerPool = new NioWorkerPool(worker, workerCount, ThreadNameDeterminer.CURRENT);
return new NioClientSocketChannelFactory(bossPool, workerPool);
}
use of org.jboss.netty.channel.socket.nio.NioClientBossPool in project druid by druid-io.
the class HttpClientInit method createBootstrap.
private static ClientBootstrap createBootstrap(Lifecycle lifecycle, Timer timer, int bossPoolSize, int workerPoolSize) {
final NioClientBossPool bossPool = new NioClientBossPool(Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("HttpClient-Netty-Boss-%s").build()), bossPoolSize, timer, ThreadNameDeterminer.CURRENT);
final NioWorkerPool workerPool = new NioWorkerPool(Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("HttpClient-Netty-Worker-%s").build()), workerPoolSize, ThreadNameDeterminer.CURRENT);
final ClientBootstrap bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(bossPool, workerPool));
bootstrap.setOption("keepAlive", true);
bootstrap.setPipelineFactory(new HttpClientPipelineFactory());
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
try {
lifecycle.addMaybeStartHandler(new Lifecycle.Handler() {
@Override
public void start() {
}
@Override
public void stop() {
bootstrap.releaseExternalResources();
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
return bootstrap;
}
use of org.jboss.netty.channel.socket.nio.NioClientBossPool in project pinpoint by naver.
the class DefaultPinpointClientFactory method createChannelFactory.
private NioClientSocketChannelFactory createChannelFactory(int bossCount, int workerCount, Timer timer) {
ExecutorService boss = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Client-Boss", true));
NioClientBossPool bossPool = new NioClientBossPool(boss, bossCount, timer, ThreadNameDeterminer.CURRENT);
ExecutorService worker = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Client-Worker", true));
NioWorkerPool workerPool = new NioWorkerPool(worker, workerCount, ThreadNameDeterminer.CURRENT);
return new NioClientSocketChannelFactory(bossPool, workerPool);
}
Aggregations