use of org.apache.hbase.thirdparty.io.netty.bootstrap.ServerBootstrap in project hbase by apache.
the class HttpProxyExample method start.
public void start() throws InterruptedException, ExecutionException {
NettyRpcClientConfigHelper.setEventLoopConfig(conf, workerGroup, NioSocketChannel.class);
conn = ConnectionFactory.createAsyncConnection(conf).get();
channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
serverChannel = new ServerBootstrap().group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childOption(ChannelOption.TCP_NODELAY, true).childOption(ChannelOption.SO_REUSEADDR, true).childHandler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
ch.pipeline().addFirst(new HttpServerCodec(), new HttpObjectAggregator(4 * 1024 * 1024), new RequestHandler(conn, channelGroup));
}
}).bind(port).syncUninterruptibly().channel();
}
Aggregations