Search in sources :

Example 1 with HttpObjectAggregator

use of org.apache.hbase.thirdparty.io.netty.handler.codec.http.HttpObjectAggregator 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();
}
Also used : DefaultChannelGroup(org.apache.hbase.thirdparty.io.netty.channel.group.DefaultChannelGroup) HttpObjectAggregator(org.apache.hbase.thirdparty.io.netty.handler.codec.http.HttpObjectAggregator) NioServerSocketChannel(org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioServerSocketChannel) Channel(org.apache.hbase.thirdparty.io.netty.channel.Channel) NioServerSocketChannel(org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioServerSocketChannel) NioSocketChannel(org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel) HttpServerCodec(org.apache.hbase.thirdparty.io.netty.handler.codec.http.HttpServerCodec) ServerBootstrap(org.apache.hbase.thirdparty.io.netty.bootstrap.ServerBootstrap) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 ServerBootstrap (org.apache.hbase.thirdparty.io.netty.bootstrap.ServerBootstrap)1 Channel (org.apache.hbase.thirdparty.io.netty.channel.Channel)1 DefaultChannelGroup (org.apache.hbase.thirdparty.io.netty.channel.group.DefaultChannelGroup)1 NioServerSocketChannel (org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioServerSocketChannel)1 NioSocketChannel (org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel)1 HttpObjectAggregator (org.apache.hbase.thirdparty.io.netty.handler.codec.http.HttpObjectAggregator)1 HttpServerCodec (org.apache.hbase.thirdparty.io.netty.handler.codec.http.HttpServerCodec)1